Alpha Framework alpha--model
[ class tree: alpha--model ] [ index: alpha--model ] [ all elements ]

Class: AlphaDAO

Source Location: /model/AlphaDAO.inc

Class AlphaDAO

Class Overview

Base business object class definition

Located in /model/AlphaDAO.inc [line 73]



		
				Author(s):
		
  • John Collins <dev@alphaframework.org>
API Tags:
Abstract:  

Information Tags:
Version:  $Id: AlphaDAO.inc 1342 2011-03-17 16:09:36Z johnc $
Copyright:  

Copyright (c) 2011, John Collins (founder of Alpha Framework). All rights reserved.

 Redistribution and use in source and binary forms, with or
 without modification, are permitted provided that the
 following conditions are met:

 * Redistributions of source code must retain the above
   copyright notice, this list of conditions and the
   following disclaimer.
 * Redistributions in binary form must reproduce the above
   copyright notice, this list of conditions and the
   following disclaimer in the documentation and/or other
   materials provided with the distribution.
 * Neither the name of the Alpha Framework nor the names
   of its contributors may be used to endorse or promote
   products derived from this software without specific
   prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Since:  1.0
License:  The BSD License

Properties

Methods

[ Top ]
Descendants
Child Class Description
ArticleCommentObject An article comment class for user comments
ArticleObject An article class for the CMS
ArticleVoteObject An article vote class for user ratings
BadRequestObject A HTTP request that resulted in a 404 response. The class is only used when the sysEnableClientTempBlacklistFiler setting is set to true to enable the filter.
BlacklistedClientObject A HTTP client that is blacklisted from accessing this application
PersonObject The main person/user class for the site
RightsObject The group level rights object for the application permissions
TagObject The tag class used in tag clouds and search
DEnum The DEnum (Dynamic Enum) complex data type. Similiar to Enum, except list items are stored in a database table and are editable.
DEnumItem The DEnumItem (Dynamic Enum Item) complex data type. Has a one-to-many relationship with the DEnum type.
RelationLookup The RelationLookup complex data type. Used to store object2object lookup tables for MANY-TO-MANY relationships between business objects
Sequence A customer sequence datatype, which is stored as a string and is made up of a string prefix and an integer sequence, which is stored in a database.

[ Top ]
Property Summary
Integer   $created_by   The OID of the person who created this BO
Timestamp   $created_ts   The timestamp of creation
array   $dataLabels   An array of the data labels used for displaying class attributes
array   $defaultAttributes   An array of the names of all of the default attributes of a persistent BO defined in this class
string   $lastQuery   The last database query run by this object. Useful for tracing an error.
integer   $OID   The object ID
array   $transientAttributes   An array of the names of all of the transient attributes of a persistent BO which are not saved to the DB
array   $uniqueAttributes   An array of the uniquely-constained attributes of this persistent BO
Integer   $updated_by   The OID of the person who last updated this BO
Timestamp   $updated_ts   The timestamp of the last update
Integer   $version_num   The version number of the object, used for locking mechanism

[ Top ]
Method Summary
static void   begin()   Starts a new database transaction.
static boolean   checkBOTableExists()   Static method to check the database and see if the table for the indicated BO class name exists (assumes table name will be $BOClassName less "Object").
static boolean   checkClassDefExists()   Checks if the definition for the BO class name provided exists on the file system.
static void   commit()   Commits the current database transaction.
static void   disconnect()   Disconnects the current database connection if one exists (self::$connection is set)
static array   getBOClassNames()   Loops over the core and custom BO directories and builds an array of all of the BO class names in the system.
static mysqli   getConnection()   Gets the current connection singleton, or creates a new one if none exists
static boolean   isInstalled()   Static method that tries to determine if the system database has been installed or not.
static void   loadClassDef()   Loads the definition from the file system for the BO class name provided.
static void   rollback()   Aborts the current database transaction.
AlphaDAO   __construct()   The constructor which sets up some housekeeping attributes
void   addProperty()   Adds in a new class property without loosing existing data (does an ALTER TABLE query on the database).
mysqli_stmt   bindParams()   Dynamically binds all of the attributes for the current BO to the supplied prepared statement parameters. If arrays of attribute names and values are provided, only those will be bound to the supplied statement.
array   bindResult()   Dynamically binds the result of the supplied prepared statement to a 2d array, where each element in the array is another array representing a database row.
AlphaDAO   cast()   Cast a BO to another type of BO. A new BO will be returned with the same OID and version_num as the old BO, so this is NOT a true cast but is a copy. All attribute values will be copied accross.
void   checkIndexes()   Checks to see if all of the indexes are in place for the BO's table, creates those that are missing.
boolean   checkRecordExists()   Checks that a record exists for the BO in the database.
boolean   checkTableExists()   Checks to see if the table exists in the database for the current business class.
boolean   checkTableNeedsUpdate()   Checks to see if the table in the database matches (for fields) the business class definition, i.e. if the database table is in sync with the class definition.
void   createForeignIndex()   Creates a foreign key constraint (index) in the database on the given attribute.
void   createUniqueIndex()   Creates a unique index in the database on the given attribute(s).
void   delete()   Deletes the current object from the database.
integer   deleteAllByAttribute()   Delete all object instances from the database by the specified attribute matching the value provided.
void   dropTable()   Drops the table if the model requirements have changed. All data is lost!
array   findMissingFields()   Returns an array containing any properties on the class which have not been created on the database table yet.
void   findOffendingValue()   Parses a MySQL error for the value that violated a unique constraint.
mixed   get()   Generic getter method for accessing class properties. Will use the method get.ucfirst($prop) instead if that method exists at a child level (by default). Set $noChildMethods to true if you don't want to use any get.ucfirst($prop) method even if it exists, false otherwise (default).
integer   getCount()   Gets the count from the database for the amount of objects of this class.
Timestamp   getCreateTS()   Method for getting the date/time of when the BO was created.
Integer   getCreatorId()   Method for getting the OID of the person who created this BO.
string   getDataLabel()   Gets the data label for the given attribute name.
array   getDataLabels()   Gets the data labels array.
array   getDefaultAttributes()   Get the array of default attribute names.
string   getFriendlyClassName()   Converts "BusinessObject" to "Business" and returns.
integer   getID()   Gets the OID for the object in zero-padded format (same as getOID()). This version is designed to be overridden in case you want to do something different with the ID of your objects outside of the standard 11 digit OID sequence used internally in Alpha.
array   getIndexes()   Gets an array of all of the names of the active database indexes for this class.
string   getLastQuery()   Get the last database query run on this object.
integer   getMAX()   Gets the maximum OID value from the database for this class type.
integer   getOID()   Gets the OID for the object in zero-padded format (same as getID()). This version is final so cannot be overridden.
array   getPersistentAttributes()   Get the array of persistent attribute names, i.e. those that are saved in the database.
AlphaType   getPropObject()   Gets the property object rather than the value for complex attributes. Returns false if the property exists but is private.
string   getTableName()   Getter for the TABLE_NAME, which should be set by a child of this class.
array   getTransientAttributes()   Get the array of transient attribute names.
Timestamp   getUpdateTS()   Method for getting the date/time of when the BO was last updated.
Integer   getUpdatorId()   Method for getting the OID of the person who updated this BO.
integer   getVersion()   Gets the version_num of the object from the database (returns 0 if the BO is not saved yet).
Integer   getVersionNumber()   Method for getting version number of the object.
boolean   hasAttribute()   Check to see if an attribute exists on the BO.
bool   isTableOverloaded()   Checks to see if the table name matches the classname, and if not if the table name matches the classname name of another BO, i.e. the table is used to store multiple types of BOs.
boolean   isTagged()   Returns true if the BO has a Relation property called tags, false otherwise.
boolean   isTransient()   Inspector to see if the business object is transient (not presently stored in the database).
void   load()   Populates the child object with the properties retrived from the database for the object $OID.
array   loadAll()   Loads all of the objects of this class into an array which is returned.
array   loadAllByAttribute()   Loads all of the objects of this class by the specified attribute into an array which is returned.
array   loadAllByAttributes()   Loads all of the objects of this class by the specified attributes into an array which is returned.
array   loadAllByDayUpdated()   Loads all of the objects of this class that where updated (updated_ts value) on the date indicated.
array   loadAllFieldValuesByAttribute()   Loads all of the specified attribute values of this class by the specified attribute into an array which is returned.
void   loadByAttribute()   Populates the child object from the database table by the given attribute value.
void   makeTable()   Builds a new database table for the BO class.
void   markPersistent()   Removes the name of the attribute provided from the list of transient (non-saved) attributes for this BO, ensuring that it will be saved on the next attempt.
void   markTransient()   Adds the name of the attribute provided to the list of transient (non-saved) attributes for this BO.
void   markUnique()   Adds the name of the attribute(s) provided to the list of unique (constrained) attributes for this BO.
void   populateFromPost()   Populates the current business object from global POST data.
void   rebuildTable()   Re-builds the table if the model requirements have changed. All data is lost!
void   reload()   Reloads the object from the database, overwritting any attribute values in memory.
void   save()   Saves the object. If $this->OID is empty or null it will INSERT, otherwise UPDATE.
void   saveAttribute()   Saves the field specified with the value supplied. Only works for persistent BOs. Note that no Alpha type validation is performed with this method!
void   set()   Generic setter method for setting class properties. Will use the method set.ucfirst($prop) instead if that method exists at a child level (by default). Set $noChildMethods to true if you don't want to use any get.ucfirst($prop) method even if it exists, false otherwise (default).
void   setEnumOptions()   Populate all of the enum options for this object from the database.
boolean   validate()   Validates the object to be saved.

[ Top ]
Properties
Integer   $created_by [line 112]

The OID of the person who created this BO

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
Timestamp   $created_ts [line 104]

The timestamp of creation

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
array   $dataLabels = array() [line 160]

An array of the data labels used for displaying class attributes

API Tags:
Access:  protected

Information Tags:
Since:  1.0

Redefined in descendants as:

[ Top ]
array   $defaultAttributes = array("OID", "lastQuery", "version_num", "dataLabels", "created_ts", "created_by", "updated_ts", "updated_by", "defaultAttributes", "transientAttributes", "uniqueAttributes", "TABLE_NAME", "logger") [line 136]

An array of the names of all of the default attributes of a persistent BO defined in this class

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
string   $lastQuery [line 88]

The last database query run by this object. Useful for tracing an error.

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
integer   $OID [line 80]

The object ID

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
array   $transientAttributes = array("lastQuery", "dataLabels", "defaultAttributes", "transientAttributes", "uniqueAttributes", "TABLE_NAME", "logger") [line 144]

An array of the names of all of the transient attributes of a persistent BO which are not saved to the DB

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
array   $uniqueAttributes = array() [line 152]

An array of the uniquely-constained attributes of this persistent BO

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
Integer   $updated_by [line 128]

The OID of the person who last updated this BO

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
Timestamp   $updated_ts [line 120]

The timestamp of the last update

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
Integer   $version_num [line 96]

The version number of the object, used for locking mechanism

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
Methods
static method begin  [line 2936]

  static void begin( )

Starts a new database transaction.


API Tags:
Access:  public

Information Tags:
Throws:  AlphaException
Since:  1.0

[ Top ]
static method checkBOTableExists  [line 1975]

  static boolean checkBOTableExists( string $BOClassName  )

Static method to check the database and see if the table for the indicated BO class name exists (assumes table name will be $BOClassName less "Object").

Parameters:
string   $BOClassName:  The name of the business object class we are checking.

API Tags:
Access:  public

Information Tags:
Throws:  AlphaException
Since:  1.0

[ Top ]
static method checkClassDefExists  [line 2795]

  static boolean checkClassDefExists( string $classname  )

Checks if the definition for the BO class name provided exists on the file system.

Parameters:
string   $classname:  The name of the business object class name.

API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
static method commit  [line 2953]

  static void commit( )

Commits the current database transaction.


API Tags:
Access:  public

Information Tags:
Throws:  FailedSaveException
Since:  1.0

[ Top ]
static method disconnect  [line 222]

  static void disconnect( )

Disconnects the current database connection if one exists (self::$connection is set)


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
static method getBOClassNames  [line 2588]

  static array getBOClassNames( )

Loops over the core and custom BO directories and builds an array of all of the BO class names in the system.


API Tags:
Return:  An array of business object class names.
Access:  public

Information Tags:
Since:  1.0

[ Top ]
static method getConnection  [line 203]

  static mysqli getConnection( )

Gets the current connection singleton, or creates a new one if none exists


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
static method isInstalled  [line 2987]

  static boolean isInstalled( )

Static method that tries to determine if the system database has been installed or not.


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
static method loadClassDef  [line 2769]

  static void loadClassDef( string $classname  )

Loads the definition from the file system for the BO class name provided.

Parameters:
string   $classname:  The name of the business object class name.

API Tags:
Access:  public

Information Tags:
Throws:  IllegalArguementException
Since:  1.0

[ Top ]
static method rollback  [line 2970]

  static void rollback( )

Aborts the current database transaction.


API Tags:
Access:  public

Information Tags:
Throws:  AlphaException
Since:  1.0

[ Top ]
Constructor __construct  [line 183]

  AlphaDAO __construct( )

The constructor which sets up some housekeeping attributes


API Tags:
Access:  public

Information Tags:
Since:  1.0

Redefined in descendants as:

[ Top ]
addProperty  [line 1474]

  void addProperty( string $propName  )

Adds in a new class property without loosing existing data (does an ALTER TABLE query on the database).

Parameters:
string   $propName:  The name of the new field to add to the database table.

API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
bindParams  [line 3099]

  mysqli_stmt bindParams( mysqli_stmt $stmt, [array $attributes = array()], [array $values = array()]  )

Dynamically binds all of the attributes for the current BO to the supplied prepared statement parameters. If arrays of attribute names and values are provided, only those will be bound to the supplied statement.

Parameters:
mysqli_stmt   $stmt:  The SQL statement to bind to.
array   $attributes:  Optional array of BO attributes.
array   $values:  Optional array of BO values.

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
bindResult  [line 3200]

  array bindResult( mysqli_stmt $stmt  )

Dynamically binds the result of the supplied prepared statement to a 2d array, where each element in the array is another array representing a database row.

Parameters:
mysqli_stmt   $stmt: 

API Tags:
Return:  A 2D array containing the query result.
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
cast  [line 3042]

  AlphaDAO cast( string $targetClassName, AlphaDAO $originalBO  )

Cast a BO to another type of BO. A new BO will be returned with the same OID and version_num as the old BO, so this is NOT a true cast but is a copy. All attribute values will be copied accross.

Parameters:
string   $targetClassName:  The name of the target BO class.
AlphaDAO   $originalBO:  The original business object.

API Tags:
Return:  The new business object resulting from the cast.
Access:  public

Information Tags:
Since:  1.0

[ Top ]
checkIndexes  [line 2320]

  void checkIndexes( )

Checks to see if all of the indexes are in place for the BO's table, creates those that are missing.


API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
checkRecordExists  [line 2823]

  boolean checkRecordExists( int $OID  )

Checks that a record exists for the BO in the database.

Parameters:
int   $OID:  The Object ID of the object we want to see whether it exists or not.

API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
checkTableExists  [line 1933]

  boolean checkTableExists( )

Checks to see if the table exists in the database for the current business class.


API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
checkTableNeedsUpdate  [line 2016]

  boolean checkTableNeedsUpdate( )

Checks to see if the table in the database matches (for fields) the business class definition, i.e. if the database table is in sync with the class definition.


API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
createForeignIndex  [line 2434]

  void createForeignIndex( string $attributeName, string $relatedClass, string $relatedClassAttribute, bool $allowNullValues  )

Creates a foreign key constraint (index) in the database on the given attribute.

Parameters:
string   $attributeName:  The name of the attribute to apply the index on.
string   $relatedClass:  The name of the related class in the format "NameObject".
string   $relatedClassAttribute:  The name of the field to relate to on the related class.
bool   $allowNullValues:  For foreign key indexes that don't allow null values, set this to false (default is true).

API Tags:
Access:  protected

Information Tags:
Since:  1.0
Throws:  FailedIndexCreateException

[ Top ]
createUniqueIndex  [line 2494]

  void createUniqueIndex( string $attribute1Name, [string $attribute2Name = '']  )

Creates a unique index in the database on the given attribute(s).

Parameters:
string   $attribute1Name:  The first attribute to mark unique in the database.
string   $attribute2Name:  The second attribute to mark unique in the databse (optional, use only for composite keys).

API Tags:
Access:  protected

Information Tags:
Since:  1.0
Throws:  FailedIndexCreateException

[ Top ]
delete  [line 1129]

  void delete( )

Deletes the current object from the database.


API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  FailedDeleteException

[ Top ]
deleteAllByAttribute  [line 1225]

  integer deleteAllByAttribute( string $attribute, mixed $value  )

Delete all object instances from the database by the specified attribute matching the value provided.

Parameters:
string   $attribute:  The name of the field to delete the objects by.
mixed   $value:  The value of the field to delete the objects by.

API Tags:
Return:  The number of rows deleted.
Access:  public

Information Tags:
Since:  1.0
Throws:  FailedDeleteException

[ Top ]
dropTable  [line 1442]

  void dropTable( [string $tableName = null]  )

Drops the table if the model requirements have changed. All data is lost!

Parameters:
string   $tableName:  Optional table name, leave blank for the defined table for this class to be dropped

API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
findMissingFields  [line 2106]

  array findMissingFields( )

Returns an array containing any properties on the class which have not been created on the database table yet.


API Tags:
Return:  An array of missing fields in the database table.
Access:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
findOffendingValue  [line 2538]

  void findOffendingValue( string $error  )

Parses a MySQL error for the value that violated a unique constraint.

Parameters:
string   $error:  The MySQL error string.

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
get  [line 1788]

  mixed get( string $prop, [boolean $noChildMethods = false]  )

Generic getter method for accessing class properties. Will use the method get.ucfirst($prop) instead if that method exists at a child level (by default). Set $noChildMethods to true if you don't want to use any get.ucfirst($prop) method even if it exists, false otherwise (default).

Parameters:
string   $prop:  The name of the object property to get.
boolean   $noChildMethods:  Set to true if you do not want to use getters in the child object, defaults to false.

API Tags:
Return:  The property value.
Access:  public

Information Tags:
Throws:  IllegalArguementException
Throws:  AlphaException
Since:  1.0

[ Top ]
getCount  [line 1634]

  integer getCount( [ $attributes = array()], [array $values = array()], array $atributes  )

Gets the count from the database for the amount of objects of this class.

Parameters:
array   $atributes:  The attributes to count the objects by (optional).
array   $values:  The values of the attributes to count the objects by (optional).
   $attributes: 

API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
getCreateTS  [line 2223]

  Timestamp getCreateTS( )

Method for getting the date/time of when the BO was created.


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getCreatorId  [line 2199]

  Integer getCreatorId( )

Method for getting the OID of the person who created this BO.


API Tags:
Return:  The OID of the creator.
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getDataLabel  [line 2569]

  string getDataLabel( $att $att  )

Gets the data label for the given attribute name.

Parameters:
$att   $att:  The attribute name to get the label for.

API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  IllegalArguementException

[ Top ]
getDataLabels  [line 2555]

  array getDataLabels( )

Gets the data labels array.


API Tags:
Return:  An array of attribute labels.
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getDefaultAttributes  [line 2636]

  array getDefaultAttributes( )

Get the array of default attribute names.


API Tags:
Return:  An array of attribute names.
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getFriendlyClassName  [line 3082]

  string getFriendlyClassName( )

Converts "BusinessObject" to "Business" and returns.


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getID  [line 1690]

  integer getID( )

Gets the OID for the object in zero-padded format (same as getOID()). This version is designed to be overridden in case you want to do something different with the ID of your objects outside of the standard 11 digit OID sequence used internally in Alpha.


API Tags:
Return:  11 digit zero-padded OID value.
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getIndexes  [line 2292]

  array getIndexes( )

Gets an array of all of the names of the active database indexes for this class.


API Tags:
Return:  An array of database indexes on this table.
Access:  protected

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
getLastQuery  [line 2718]

  string getLastQuery( )

Get the last database query run on this object.


API Tags:
Return:  An SQL query string.
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getMAX  [line 1598]

  integer getMAX( )

Gets the maximum OID value from the database for this class type.


API Tags:
Return:  The maximum OID value in the class table.
Access:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
getOID  [line 1704]

  integer getOID( )

Gets the OID for the object in zero-padded format (same as getID()). This version is final so cannot be overridden.


API Tags:
Return:  11 digit zero-padded OID value.
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getPersistentAttributes  [line 2660]

  array getPersistentAttributes( )

Get the array of persistent attribute names, i.e. those that are saved in the database.


API Tags:
Return:  An array of attribute names.
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getPropObject  [line 1889]

  AlphaType getPropObject( string $prop  )

Gets the property object rather than the value for complex attributes. Returns false if the property exists but is private.

Parameters:
string   $prop:  The name of the property we are getting.

API Tags:
Return:  The complex type object found.
Access:  public

Information Tags:
Since:  1.0
Throws:  IllegalArguementException

[ Top ]
getTableName  [line 2178]

  string getTableName( )

Getter for the TABLE_NAME, which should be set by a child of this class.


API Tags:
Return:  The table name in the database.
Access:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

Redefined in descendants as:
  • RelationLookup::getTableName() : Custom getter for the TABLE_NAME, which can't be static in this class due to the lookup tablenames being different each time.

[ Top ]
getTransientAttributes  [line 2648]

  array getTransientAttributes( )

Get the array of transient attribute names.


API Tags:
Return:  An array of attribute names.
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getUpdateTS  [line 2235]

  Timestamp getUpdateTS( )

Method for getting the date/time of when the BO was last updated.


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getUpdatorId  [line 2211]

  Integer getUpdatorId( )

Method for getting the OID of the person who updated this BO.


API Tags:
Return:  The OID of the updator.
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getVersion  [line 1263]

  integer getVersion( )

Gets the version_num of the object from the database (returns 0 if the BO is not saved yet).


API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  BONotFoundException

[ Top ]
getVersionNumber  [line 1717]

  Integer getVersionNumber( )

Method for getting version number of the object.


API Tags:
Return:  The object version number.
Access:  public

Information Tags:
Since:  1.0

[ Top ]
hasAttribute  [line 3236]

  boolean hasAttribute( $attribute $attribute  )

Check to see if an attribute exists on the BO.

Parameters:
$attribute   $attribute:  The attribute name.

API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
isTableOverloaded  [line 2876]

  bool isTableOverloaded( )

Checks to see if the table name matches the classname, and if not if the table name matches the classname name of another BO, i.e. the table is used to store multiple types of BOs.


API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  BadBOTableNameException

[ Top ]
isTagged  [line 3015]

  boolean isTagged( )

Returns true if the BO has a Relation property called tags, false otherwise.


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
isTransient  [line 2700]

  boolean isTransient( )

Inspector to see if the business object is transient (not presently stored in the database).


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
load  [line 236]

  void load( integer $OID  )

Populates the child object with the properties retrived from the database for the object $OID.

Parameters:
integer   $OID:  The object ID of the business object to load.

API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  BONotFoundException

[ Top ]
loadAll  [line 461]

  array loadAll( [integer $start = 0], [integer $limit = 0], [string $orderBy = 'OID'], [string $order = 'ASC'], [boolean $ignoreClassType = false]  )

Loads all of the objects of this class into an array which is returned.

Parameters:
integer   $start:  The start of the SQL LIMIT clause, useful for pagination.
integer   $limit:  The amount (limit) of objects to load, useful for pagination.
string   $orderBy:  The name of the field to sort the objects by.
string   $order:  The order to sort the objects by.
boolean   $ignoreClassType:  Default is false, set to true if you want to load from overloaded tables and ignore the class type

API Tags:
Return:  An array containing objects of this type of business object.
Access:  public

Information Tags:
Since:  1.0
Throws:  BONotFoundException

[ Top ]
loadAllByAttribute  [line 535]

  array loadAllByAttribute( $attribute, string $value, [integer $start = 0], [integer $limit = 0], [string $orderBy = "OID"], [string $order = "ASC"], [boolean $ignoreClassType = false], string $atribute  )

Loads all of the objects of this class by the specified attribute into an array which is returned.

Parameters:
string   $atribute:  The attribute to load the objects by.
string   $value:  The value of the attribute to load the objects by.
integer   $start:  The start of the SQL LIMIT clause, useful for pagination.
integer   $limit:  The amount (limit) of objects to load, useful for pagination.
string   $orderBy:  The name of the field to sort the objects by.
string   $order:  The order to sort the objects by.
boolean   $ignoreClassType:  Default is false, set to true if you want to load from overloaded tables and ignore the class type
   $attribute: 

API Tags:
Return:  An array containing objects of this type of business object.
Access:  public

Information Tags:
Since:  1.0
Throws:  BONotFoundException

Redefined in descendants as:

[ Top ]
loadAllByAttributes  [line 628]

  array loadAllByAttributes( [ $attributes = array()], [array $values = array()], [integer $start = 0], [integer $limit = 0], [string $orderBy = 'OID'], [string $order = 'ASC'], [boolean $ignoreClassType = false], array $atributes  )

Loads all of the objects of this class by the specified attributes into an array which is returned.

Parameters:
array   $atributes:  The attributes to load the objects by.
array   $values:  The values of the attributes to load the objects by.
integer   $start:  The start of the SQL LIMIT clause, useful for pagination.
integer   $limit:  The amount (limit) of objects to load, useful for pagination.
string   $orderBy:  The name of the field to sort the objects by.
string   $order:  The order to sort the objects by.
boolean   $ignoreClassType:  Default is false, set to true if you want to load from overloaded tables and ignore the class type
   $attributes: 

API Tags:
Return:  An array containing objects of this type of business object.
Access:  public

Information Tags:
Throws:  BONotFoundException
Throws:  IllegalArguementException
Since:  1.0

[ Top ]
loadAllByDayUpdated  [line 732]

  array loadAllByDayUpdated( string $date, [integer $start = 0], [integer $limit = 0], [string $orderBy = "OID"], [string $order = "ASC"], [boolean $ignoreClassType = false]  )

Loads all of the objects of this class that where updated (updated_ts value) on the date indicated.

Parameters:
string   $date:  The date for which to load the objects updated on, in the format 'YYYY-MM-DD'.
integer   $start:  The start of the SQL LIMIT clause, useful for pagination.
integer   $limit:  The amount (limit) of objects to load, useful for pagination.
string   $orderBy:  The name of the field to sort the objects by.
string   $order:  The order to sort the objects by.
boolean   $ignoreClassType:  Default is false, set to true if you want to load from overloaded tables and ignore the class type

API Tags:
Return:  An array containing objects of this type of business object.
Access:  public

Information Tags:
Since:  1.0
Throws:  BONotFoundException

[ Top ]
loadAllFieldValuesByAttribute  [line 790]

  array loadAllFieldValuesByAttribute( string $attribute, string $value, string $returnAttribute, [string $order = 'ASC'], [boolean $ignoreClassType = false]  )

Loads all of the specified attribute values of this class by the specified attribute into an array which is returned.

Parameters:
string   $attribute:  The attribute name to load the field values by.
string   $value:  The value of the attribute to load the field values by.
string   $returnAttribute:  The name of the attribute to return.
string   $order:  The order to sort the BOs by.
boolean   $ignoreClassType:  Default is false, set to true if you want to load from overloaded tables and ignore the class type.

API Tags:
Return:  An array of field values.
Access:  public

Information Tags:
Since:  1.0
Throws:  BONotFoundException

[ Top ]
loadByAttribute  [line 335]

  void loadByAttribute( $attribute, string $value, [boolean $ignoreClassType = false], [array $attributes = array()], string $atribute  )

Populates the child object from the database table by the given attribute value.

Parameters:
string   $atribute:  The name of the attribute to load the object by.
string   $value:  The value of the attribute to load the object by.
boolean   $ignoreClassType:  Default is false, set to true if you want to load from overloaded tables and ignore the class type
array   $attributes:  The attributes to load from the database to this object (leave blank to load all attributes)
   $attribute: 

API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  BONotFoundException

[ Top ]
makeTable  [line 1316]

  void makeTable( )

Builds a new database table for the BO class.


API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
markPersistent  [line 2260]

  void markPersistent( string $attributeName  )

Removes the name of the attribute provided from the list of transient (non-saved) attributes for this BO, ensuring that it will be saved on the next attempt.

Parameters:
string   $attributeName:  The name of the attribute to save.

API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
markTransient  [line 2247]

  void markTransient( string $attributeName  )

Adds the name of the attribute provided to the list of transient (non-saved) attributes for this BO.

Parameters:
string   $attributeName:  The name of the attribute to not save.

API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
markUnique  [line 2273]

  void markUnique( string $attribute1Name, [string $attribute2Name = '']  )

Adds the name of the attribute(s) provided to the list of unique (constrained) attributes for this BO.

Parameters:
string   $attribute1Name:  The first attribute to mark unique in the database.
string   $attribute2Name:  The second attribute to mark unique in the databse (optional, use only for composite keys).

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
populateFromPost  [line 1555]

  void populateFromPost( )

Populates the current business object from global POST data.


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
rebuildTable  [line 1412]

  void rebuildTable( )

Re-builds the table if the model requirements have changed. All data is lost!


API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
reload  [line 2751]

  void reload( )

Reloads the object from the database, overwritting any attribute values in memory.


API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
save  [line 832]

  void save( )

Saves the object. If $this->OID is empty or null it will INSERT, otherwise UPDATE.


API Tags:
Access:  public

Information Tags:
Throws:  FailedSaveException
Since:  1.0
Throws:  LockingException
Throws:  ValidationException

[ Top ]
saveAttribute  [line 1041]

  void saveAttribute( string $attribute, mixed $value  )

Saves the field specified with the value supplied. Only works for persistent BOs. Note that no Alpha type validation is performed with this method!

Parameters:
string   $attribute:  The name of the attribute to save.
mixed   $value:  The value of the attribute to save.

API Tags:
Access:  public

Information Tags:
Throws:  IllegalArguementException
Throws:  FailedSaveException
Since:  1.0

[ Top ]
set  [line 1843]

  void set( string $prop, mixed $value, [boolean $noChildMethods = false]  )

Generic setter method for setting class properties. Will use the method set.ucfirst($prop) instead if that method exists at a child level (by default). Set $noChildMethods to true if you don't want to use any get.ucfirst($prop) method even if it exists, false otherwise (default).

Parameters:
string   $prop:  The name of the property to set.
mixed   $value:  The value of the property to set.
boolean   $noChildMethods:  Set to true if you do not want to use setters in the child object, defaults to false.

API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
setEnumOptions  [line 1729]

  void setEnumOptions( )

Populate all of the enum options for this object from the database.


API Tags:
Access:  protected

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
validate  [line 1088]

  boolean validate( )

Validates the object to be saved.


API Tags:
Access:  protected

Information Tags:
Since:  1.0
Throws:  ValidationException

[ Top ]

Documentation generated on Thu, 17 Mar 2011 16:43:23 +0000 by phpDocumentor 1.4.3