| alpha--model

# Interface: AlphaDAOProviderInterface Source Location: /model/AlphaDAOProviderInterface.inc ## Interface AlphaDAOProviderInterface Interface Overview
An interface that defines all of the Data Access Object (DAO) methods that should be included in a provider that implements this interface. Located in /model/AlphaDAOProviderInterface.inc [line 48]
Author(s): John Collins <dev@alphaframework.org> Information Tags:
Version: | $Id: AlphaDAOProviderInterface.inc 1453 2011-12-04 15:12:54Z 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.1
License: | The BSD License
| Methods addProperty begin checkBOTableExists checkRecordExists checkTableExists checkTableNeedsUpdate commit createForeignIndex createUniqueIndex delete disconnect dropTable findMissingFields getConnection getCount getIndexes getLastDatabaseError getMAX getVersion isTableOverloaded load loadAll loadAllByAttribute loadAllByAttributes loadAllByDayUpdated loadAllFieldValuesByAttribute loadByAttribute makeTable query rebuildTable reload rollback save saveAttribute setBO setEnumOptions
[ 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 void | commit() | Commits the current database transaction.
static void | disconnect() | Disconnects the current database connection if one exists (self::$connection is set)
static mysqli | getConnection() | Gets the current connection singleton, or creates a new one if none exists
static string | getLastDatabaseError() | Returns the last database error string for the current connection.
static void | rollback() | Aborts the current database transaction.
void | addProperty() | Adds in a new class property without loosing existing data (does an ALTER TABLE query on the database).
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.
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.
integer | getCount() | Gets the count from the database for the amount of objects of this class.
array | getIndexes() | Gets an array of all of the names of the active database indexes for this class.
integer | getMAX() | Gets the maximum OID value from the database for this class type.
integer | getVersion() | Gets the version_num of the object from the database (returns 0 if the BO is not saved yet).
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.
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.
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 | 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 | setBO() | Provide the BO that we are going to map the data to from this provider.
void | setEnumOptions() | Populate all of the enum options for this object from the database.
[ Top ] Methods static method begin [line 381]
`static void begin( )`
Starts a new database transaction. API Tags:
Access: | public
Information Tags:
Throws: | AlphaException
Since: | 1.1
[ Top ] static method checkBOTableExists [line 292]
`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.1
[ Top ] static method commit [line 389]
`static void commit( )`
Commits the current database transaction. API Tags:
Access: | public
Information Tags:
Throws: | FailedSaveException
Since: | 1.1
[ Top ] static method disconnect [line 62]
`static void disconnect( )`
Disconnects the current database connection if one exists (self::$connection is set) API Tags:
Access: | public
Information Tags:
Since: | 1.1
[ Top ] static method getConnection [line 55]
`static mysqli getConnection( )`
Gets the current connection singleton, or creates a new one if none exists API Tags:
Access: | public
Information Tags:
Since: | 1.1
[ Top ] static method getLastDatabaseError [line 70]
`static string getLastDatabaseError( )`
Returns the last database error string for the current connection. API Tags:
Access: | public
Information Tags:
Since: | 1.1
[ Top ] static method rollback [line 397]
`static void rollback( )`
Aborts the current database transaction. API Tags:
Access: | public
Information Tags:
Throws: | AlphaException
Since: | 1.1
[ Top ] addProperty [line 244]
`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.1
Throws: | AlphaException
[ Top ] checkRecordExists [line 362]
`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.1
Throws: | AlphaException
[ Top ] checkTableExists [line 281]
`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.1
Throws: | AlphaException
[ Top ] checkTableNeedsUpdate [line 302]
`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.1
Throws: | AlphaException
[ Top ] createForeignIndex [line 333]
`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.1
Throws: | FailedIndexCreateException
[ Top ] createUniqueIndex [line 344]
`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.1
Throws: | FailedIndexCreateException
[ Top ] delete [line 200]
`void delete( )`
Deletes the current object from the database. API Tags:
Access: | public
Information Tags:
Since: | 1.1
Throws: | FailedDeleteException
[ Top ] dropTable [line 234]
`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.1
Throws: | AlphaException
[ Top ] findMissingFields [line 312]
`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.1
Throws: | AlphaException
[ Top ] getCount [line 264]
`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.1
Throws: | AlphaException
[ Top ] getIndexes [line 321]
`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.1
Throws: | AlphaException
[ Top ] getMAX [line 253]
`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.1
Throws: | AlphaException
[ Top ] getVersion [line 209]
`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.1
Throws: | BONotFoundException
[ Top ] isTableOverloaded [line 373]
`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.1
Throws: | BadBOTableNameException
[ Top ] load [line 79]
`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.1
Throws: | BONotFoundException
[ Top ] loadAll [line 105]
`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.1
Throws: | BONotFoundException
[ Top ] loadAllByAttribute [line 123]
`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.1
[ Top ] loadAllByAttributes [line 140]
`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.1
[ Top ] loadAllByDayUpdated [line 155]
`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.1
Throws: | BONotFoundException
[ Top ] loadAllFieldValuesByAttribute [line 170]
`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.1
Throws: | BONotFoundException
[ Top ] loadByAttribute [line 91]
`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.1
Throws: | BONotFoundException
[ Top ] makeTable [line 217]
`void makeTable( )`
Builds a new database table for the BO class. API Tags:
Access: | public
Information Tags:
Since: | 1.1
Throws: | AlphaException
[ Top ] query [line 416]
`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:
Throws: | CustomQueryException
Since: | 1.1
[ Top ] rebuildTable [line 225]
`void rebuildTable( )`
Re-builds the table if the model requirements have changed. All data is lost! API Tags:
Access: | public
Information Tags:
Since: | 1.1
Throws: | AlphaException
[ Top ] reload [line 352]
`void reload( )`
Reloads the object from the database, overwritting any attribute values in memory. API Tags:
Access: | public
Information Tags:
Since: | 1.1
Throws: | AlphaException
[ Top ] save [line 180]
`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.1
Throws: | LockingException
Throws: | ValidationException
[ Top ] saveAttribute [line 192]
`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.1
[ Top ] setBO [line 405]
`void setBO( AlphaDAO $BO )`
Provide the BO that we are going to map the data to from this provider. Parameters:
AlphaDAO | $BO: |
API Tags:
Access: | public
Information Tags:
Since: | 1.1
[ Top ] setEnumOptions [line 272]
`void setEnumOptions( )`
Populate all of the enum options for this object from the database. API Tags:
Access: | public
Information Tags:
Since: | 1.1
Throws: | AlphaException
[ Top ] Documentation generated on Tue, 13 Dec 2011 20:25:49 +0000 by phpDocumentor 1.4.3