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 providing DAO storage via the configured provider.

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



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

Information Tags:
Version:  $Id: AlphaDAO.inc 1464 2011-12-08 21:18:22Z 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
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).
void   addToCache()   Stores the business object to the configured cache instance
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.
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.
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.
array   getUniqueAttributes()   Returns the array of names of unique attributes on this BO
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.
boolean   loadFromCache()   Attempts to load the business object from the configured cache instance
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.
array   query()   Returns a 2d array, where each element in the array is another array representing a database row.
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   removeFromCache()   Removes the business object from the configured cache instance
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.
void   setLastQuery()   Sets the last query executed on this business object
void   setOID()   Setter for the Object ID (OID)
boolean   validate()   Validates the object to be saved.

[ Top ]
Properties
Integer   $created_by [line 115]

The OID of the person who created this BO

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
Timestamp   $created_ts [line 107]

The timestamp of creation

API Tags:
Access:  protected

Information Tags:
Since:  1.0

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

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 139]

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 91]

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 83]

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 147]

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 155]

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 131]

The OID of the person who last updated this BO

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
Timestamp   $updated_ts [line 123]

The timestamp of the last update

API Tags:
Access:  protected

Information Tags:
Since:  1.0

[ Top ]
Integer   $version_num [line 99]

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 1779]

  static void begin( )

Starts a new database transaction.


API Tags:
Access:  public

Information Tags:
Throws:  AlphaException
Since:  1.0

[ Top ]
static method checkBOTableExists  [line 1171]

  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 1706]

  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 1803]

  static void commit( )

Commits the current database transaction.


API Tags:
Access:  public

Information Tags:
Throws:  FailedSaveException
Since:  1.0

[ Top ]
static method disconnect  [line 210]

  static void disconnect( )

Disconnects the current database connection if one exists


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
static method getBOClassNames  [line 1499]

  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 200]

  static mysqli getConnection( )

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


API Tags:
Deprecated:  
Access:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
static method isInstalled  [line 1851]

  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 1680]

  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 1827]

  static void rollback( )

Aborts the current database transaction.


API Tags:
Access:  public

Information Tags:
Throws:  AlphaException
Since:  1.0

[ Top ]
Constructor __construct  [line 178]

  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 801]

  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 ]
addToCache  [line 1973]

  void addToCache( )

Stores the business object to the configured cache instance


API Tags:
Access:  public

Information Tags:
Since:  1.1

[ Top ]
cast  [line 1906]

  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 ]
checkRecordExists  [line 1734]

  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 1144]

  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 1193]

  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 1407]

  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:  public

Information Tags:
Since:  1.0
Throws:  FailedIndexCreateException

[ Top ]
createUniqueIndex  [line 1443]

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

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).
string   $attribute3Name:  The third attribute to mark unique in the databse (optional, use only for composite keys).

API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  FailedIndexCreateException

[ Top ]
delete  [line 577]

  void delete( )

Deletes the current object from the database.


API Tags:
Access:  public

Information Tags:
Since:  1.0
Throws:  FailedDeleteException

[ Top ]
deleteAllByAttribute  [line 665]

  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 776]

  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 1227]

  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 ]
get  [line 999]

  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 901]

  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 1297]

  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 1273]

  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 1480]

  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 1466]

  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 1547]

  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 1946]

  string getFriendlyClassName( )

Converts "BusinessObject" to "Business" and returns.


API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
getID  [line 931]

  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 1385]

  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:  public

Information Tags:
Since:  1.0
Throws:  AlphaException

[ Top ]
getLastQuery  [line 1629]

  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 874]

  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 945]

  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 1571]

  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 1100]

  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 1252]

  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 1559]

  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 ]
getUniqueAttributes  [line 1372]

  array getUniqueAttributes( )

Returns the array of names of unique attributes on this BO


API Tags:
Access:  public

Information Tags:
Since:  1.1

[ Top ]
getUpdateTS  [line 1309]

  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 1285]

  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 703]

  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 960]

  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 1959]

  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 1761]

  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 1879]

  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 1611]

  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 239]

  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 312]

  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 346]

  array loadAllByAttribute( $attribute, string $value, [integer $start = 0], [integer $limit = 0], [string $orderBy = "OID"], [string $order = "ASC"], [boolean $ignoreClassType = false], [array $constructorArgs = array()], 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.
array   $constructorArgs:  An optional array of contructor arguements to pass to the BOs that will be generated and returned. Supports a maximum of 5 arguements.
   $attribute: 

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

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

Redefined in descendants as:

[ Top ]
loadAllByAttributes  [line 379]

  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 416]

  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 447]

  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 277]

  void loadByAttribute( $attribute, string $value, [boolean $ignoreClassType = false], [array $loadAttributes = 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   $loadAttributes:  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 ]
loadFromCache  [line 2015]

  boolean loadFromCache( )

Attempts to load the business object from the configured cache instance


API Tags:
Access:  public

Information Tags:
Since:  1.1

[ Top ]
makeTable  [line 727]

  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 1334]

  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 1321]

  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 1348]

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

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).
string   $attribute3Name:  The third 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 824]

  void populateFromPost( [boolean $filterAll = false]  )

Populates the current business object from global POST data.

Parameters:
boolean   $filterAll:  Defaults to false, set to true if you want to strictly filter all POSTed user input using InputFilter::encode.

API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
query  [line 225]

  array query( string $sqlQuery  )

Returns a 2d array, where each element in the array is another array representing a database row.

Parameters:
string   $sqlQuery: 

API Tags:
Access:  public

Information Tags:
Since:  1.1
Throws:  CustomQueryException

[ Top ]
rebuildTable  [line 752]

  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 1662]

  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 ]
removeFromCache  [line 1994]

  void removeFromCache( )

Removes the business object from the configured cache instance


API Tags:
Access:  public

Information Tags:
Since:  1.1

[ Top ]
save  [line 467]

  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 501]

  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 1054]

  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 972]

  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 ]
setLastQuery  [line 2066]

  void setLastQuery( string $query  )

Sets the last query executed on this business object

Parameters:
string   $query: 

API Tags:
Access:  public

Information Tags:
Since:  1.1

[ Top ]
setOID  [line 1599]

  void setOID( integer $OID  )

Setter for the Object ID (OID)

Parameters:
integer   $OID:  The Object ID.

API Tags:
Access:  public

Information Tags:
Since:  1.0

[ Top ]
validate  [line 536]

  boolean validate( )

Validates the object to be saved.


API Tags:
Access:  protected

Information Tags:
Since:  1.0
Throws:  ValidationException

[ Top ]

Documentation generated on Tue, 13 Dec 2011 20:25:47 +0000 by phpDocumentor 1.4.3