| [ Index ] |
PHP Cross Reference of Limb3 |
[Source view] [Print] [Project Stats]
(no description)
| File Size: | 1938 lines (55 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
lmbActiveRecord:: (176 methods):
__construct()
setDefaultDSN()
setDefaultConnection()
getDefaultConnection()
getInheritanceField()
setInheritanceField()
getTableName()
getDbTable()
getErrorList()
_defineRelations()
_hasOne()
_hasMany()
_hasManyToMany()
_belongsTo()
_manyBelongsTo()
_composedOf()
getRelationInfo()
_getAllRelations()
getOneToManyRelationsInfo()
getManyToManyRelationsInfo()
getBelongsToRelationsInfo()
getManyBelongsToRelationsInfo()
getDefaultSortParams()
_createTableObjectByAlias()
_createValidator()
_createInsertValidator()
_createUpdateValidator()
_savePreRelations()
_savePreRelationObject()
_savePostRelations()
_savePostRelationCollection()
_savePostRelationObject()
__call()
_addToProperty()
_izLazyAttribute()
_hasLazyAttributes()
_loadLazyAttribute()
_loadLazyAttributes()
get()
createRelationCollection()
_hasCollectionRelation()
set()
_setRaw()
_markDirtyProperty()
_canPropertyBeDirty()
_canRelationPropertyBeDirty()
resetDirty()
_resetDirty()
markDirty()
isDirty()
isDirtyProperty()
mapPropertyToAddToMethod()
mapAddToProperty()
mapFieldToProperty()
_hasBelongsToRelation()
_hasManyBelongsToRelation()
_hasOneToOneRelation()
_hasOneToManyRelation()
_hasManyToManyRelation()
_hasValueObjectRelation()
_loadBelongsToObject()
_loadManyBelongsToObject()
_loadOneToOneObject()
_canHasOneObjectBeNull()
_canManyBelongsToObjectBeNull()
_loadValueObject()
_createValueObject()
_mapMethodToClass()
_getValueObject()
_doSave()
_updateDbRecord()
_insertDbRecord()
_propertiesToDbFields()
_setAutoTimes()
_hasUpdateTime()
_hasCreateTime()
_isInheritable()
save()
saveSkipValidation()
trySave()
isNew()
setIsNew()
detach()
validate()
_onBeforeUpdate()
_onBeforeCreate()
_onBeforeSave()
_onBeforeDestroy()
_onAfterSave()
_onUpdate()
_onCreate()
_onSave()
_onAfterUpdate()
_onAfterCreate()
_onAfterDestroy()
_onValidate()
_validateInsert()
_validateUpdate()
_validate()
_addError()
isValid()
_isCriteria()
findFirst()
findOne()
_findFirst()
findById()
_findById()
findByIds()
_findByIds()
getDataset()
findBySql()
findFirstBySql()
findOneBySql()
find()
_find()
findAllRecords()
addClassCriteria()
getInheritanceCondition()
_getInheritancePath()
decodeInheritancePath()
getInheritanceClass()
loadById()
loadFromRecord()
_setDbValue()
_decodeDbValues()
getId()
setId()
getUpdateTime()
getCreateTime()
destroy()
_deleteDbRecord()
delete()
deleteRaw()
updateRaw()
_getColumnsForSelect()
_removeOneToOneObjects()
_removeOneToManyObjects()
_removeManyToManyRecords()
_removeBelongsToRelations()
_createSQLStatement()
_query()
_execute()
decorateRecordSet()
_decorateRecordSet()
__clone()
import()
importRaw()
_canImportProperty()
_importCollection()
_importEntity()
_importValueObject()
export()
exportRaw()
registerCallback()
registerOnBeforeSaveCallback()
registerOnAfterSaveCallback()
registerOnBeforeUpdateCallback()
registerOnUpdateCallback()
registerOnAfterUpdateCallback()
registerOnBeforeCreateCallback()
registerOnCreateCallback()
registerOnAfterCreateCallback()
registerOnBeforeDestroyCallback()
registerOnAfterDestroyCallback()
registerGlobalCallback()
registerGlobalOnBeforeSaveCallback()
registerGlobalOnAfterSaveCallback()
registerGlobalOnBeforeUpdateCallback()
registerGlobalOnUpdateCallback()
registerGlobalOnAfterUpdateCallback()
registerGlobalOnBeforeCreateCallback()
registerGlobalOnCreateCallback()
registerGlobalOnAfterCreateCallback()
registerGlobalOnBeforeDestroyCallback()
registerGlobalOnAfterDestroyCallback()
_invokeListeners()
Class: lmbActiveRecord - X-Ref
Base class responsible for ActiveRecord design pattern implementation. Inspired by Rails ActiveRecord class.| __construct($magic_params = null, $conn = null) X-Ref |
| Constructor. Creates an instance of lmbActiveRecord object in different ways depending on passed argument <code> //plain vanilla instance $b = new Book(); //fills instance with passed properties $b = new Book(array('title' => 'Alice in Wonderland')); //tries to load instance from database using 1 as a primary key identifier $b = new Book(1); </code> param: array|integer Depending on argument type the new object is filled with properties or loaded from database |
| setDefaultDSN($dsn) X-Ref |
| Sets database resource identifier used for database access param: string DSN, e.g. mysql://root:secret@localhost/mydb |
| setDefaultConnection($conn) X-Ref |
| Sets default database connection object param: object instance of concrete lmbDbConnection interface implementation return: object previous connection object |
| getDefaultConnection() X-Ref |
| Returns current default database connection object return: object instance of concrete lmbDbConnection interface implementation |
| getInheritanceField() X-Ref |
| Returns current single table inheritance column name return: string |
| setInheritanceField($field) X-Ref |
| Allows to override default single table inheritance column name param: string |
| getTableName() X-Ref |
| Returns name of database table return: string |
| getDbTable() X-Ref |
| Returns table gateway instance used for all db interactions return: object |
| getErrorList() X-Ref |
| Returns error list object with all validation errors return: object |
| _defineRelations() X-Ref |
| No description |
| _hasOne($relation_name, $info) X-Ref |
| No description |
| _hasMany($relation_name, $info) X-Ref |
| No description |
| _hasManyToMany($relation_name, $info) X-Ref |
| No description |
| _belongsTo($relation_name, $info) X-Ref |
| No description |
| _manyBelongsTo($relation_name, $info) X-Ref |
| No description |
| _composedOf($relation_name, $info) X-Ref |
| No description |
| getRelationInfo($relation) X-Ref |
| Returns relation info array defined during class declaration return: array |
| _getAllRelations() X-Ref |
| No description |
| getOneToManyRelationsInfo() X-Ref |
| Returns all relations info for one-to-many return: array |
| getManyToManyRelationsInfo() X-Ref |
| Returns all relations info for many-to-many return: array |
| getBelongsToRelationsInfo() X-Ref |
| Returns all relations info for belongs-to return: array |
| getManyBelongsToRelationsInfo() X-Ref |
| Returns all relations info for many-belongs-to return: array |
| getDefaultSortParams() X-Ref |
| Returns default sort params return: array |
| _createTableObjectByAlias($class_path_alias) X-Ref |
| No description |
| _createValidator() X-Ref |
| Returns common validator for create and update operations. It should be overridden if you want to have a custom validator, e.g: <code> $validator = new lmbValidator(); $validator->addRequiredRule('title'); return $validator; </code> return: object |
| _createInsertValidator() X-Ref |
| Returns validator for create operations only. return: object |
| _createUpdateValidator() X-Ref |
| Returns validator for update operations only. return: object |
| _savePreRelations() X-Ref |
| No description |
| _savePreRelationObject($property, $info, $save_relation_obj = true) X-Ref |
| No description |
| _savePostRelations() X-Ref |
| No description |
| _savePostRelationCollection($property, $info) X-Ref |
| No description |
| _savePostRelationObject($property, $info) X-Ref |
| No description |
| __call($method, $args = array() X-Ref |
| No description |
| _addToProperty($property, $value) X-Ref |
| No description |
| _izLazyAttribute($property) X-Ref |
| No description |
| _hasLazyAttributes() X-Ref |
| No description |
| _loadLazyAttribute($property) X-Ref |
| No description |
| _loadLazyAttributes() X-Ref |
| No description |
| get($property) X-Ref |
| Generic magic getter for any attribute param: string property name return: mixed |
| createRelationCollection($relation, $criteria = null) X-Ref |
| No description |
| _hasCollectionRelation($relation) X-Ref |
| No description |
| set($property, $value) X-Ref |
| Generic magis getter for any attribute param: string property name param: mixed property value |
| _setRaw($property, $value) X-Ref |
| No description |
| _markDirtyProperty($property) X-Ref |
| No description |
| _canPropertyBeDirty($property) X-Ref |
| No description |
| _canRelationPropertyBeDirty($property, $info) X-Ref |
| No description |
| resetDirty() X-Ref |
| No description |
| _resetDirty() X-Ref |
| No description |
| markDirty() X-Ref |
| Marks object as dirty |
| isDirty() X-Ref |
| Returns object's dirtiness status return: boolean |
| isDirtyProperty($property) X-Ref |
| Returns object's property dirtiness status param: string return: boolean |
| mapPropertyToAddToMethod($property) X-Ref |
| Maps property name to "addTo" form, e.g. "property_name" => "addToPropertyName" param: string return: string |
| mapAddToProperty($method) X-Ref |
| Maps "addTo" to property, e.g. "addToPropertyName" => "property_name" param: string return: string |
| mapFieldToProperty($field) X-Ref |
| Maps database field to property name param: string return: string |
| _hasBelongsToRelation($property) X-Ref |
| No description |
| _hasManyBelongsToRelation($property) X-Ref |
| No description |
| _hasOneToOneRelation($property) X-Ref |
| No description |
| _hasOneToManyRelation($property) X-Ref |
| No description |
| _hasManyToManyRelation($property) X-Ref |
| No description |
| _hasValueObjectRelation($property) X-Ref |
| No description |
| _loadBelongsToObject($property) X-Ref |
| No description |
| _loadManyBelongsToObject($property) X-Ref |
| No description |
| _loadOneToOneObject($property) X-Ref |
| No description |
| _canHasOneObjectBeNull($property) X-Ref |
| No description |
| _canManyBelongsToObjectBeNull($property) X-Ref |
| No description |
| _loadValueObject($property) X-Ref |
| No description |
| _createValueObject($class, $value) X-Ref |
| No description |
| _mapMethodToClass($method) X-Ref |
| No description |
| _getValueObject($property) X-Ref |
| No description |
| _doSave($need_validation) X-Ref |
| No description |
| _updateDbRecord($values) X-Ref |
| No description |
| _insertDbRecord($values) X-Ref |
| No description |
| _propertiesToDbFields() X-Ref |
| No description |
| _setAutoTimes() X-Ref |
| No description |
| _hasUpdateTime() X-Ref |
| No description |
| _hasCreateTime() X-Ref |
| No description |
| _isInheritable() X-Ref |
| No description |
| save($error_list = null) X-Ref |
| Validates object and saves into database, throws exception if there were any errors param: object error list object which will receive all validation errors return: integer id of the saved object |
| saveSkipValidation() X-Ref |
| Saves object into database skipping any validation, throws exception if there were any errors return: integer id of the saved object |
| trySave($error_list = null) X-Ref |
| Validates object and saves into database, catches all exceptions if there were any errors param: object error list object which will receive all validation errors return: boolean success status of operation |
| isNew() X-Ref |
| Returns whether object is new return: boolean |
| setIsNew($value = true) X-Ref |
| Forces object to be new or not param: boolean new status |
| detach() X-Ref |
| Detaches object by making it new and removing its identity |
| validate($error_list = null) X-Ref |
| Validates object param: object error list object which will receive all validation errors return: boolean validation status |
| _onBeforeUpdate() X-Ref |
| No description |
| _onBeforeCreate() X-Ref |
| No description |
| _onBeforeSave() X-Ref |
| No description |
| _onBeforeDestroy() X-Ref |
| No description |
| _onAfterSave() X-Ref |
| No description |
| _onUpdate() X-Ref |
| No description |
| _onCreate() X-Ref |
| No description |
| _onSave() X-Ref |
| No description |
| _onAfterUpdate() X-Ref |
| No description |
| _onAfterCreate() X-Ref |
| No description |
| _onAfterDestroy() X-Ref |
| No description |
| _onValidate() X-Ref |
| No description |
| _validateInsert() X-Ref |
| No description |
| _validateUpdate() X-Ref |
| No description |
| _validate($validator) X-Ref |
| No description |
| _addError($message, $fields = array() X-Ref |
| No description |
| isValid() X-Ref |
| No description |
| _isCriteria($params) X-Ref |
| No description |
| findFirst($class_name, $magic_params = array() X-Ref |
| Finds one instance of object in database, this method is actually a wrapper around find() param: string class name of the object param: mixed misc magic params param: object database connection object return: object|null |
| findOne($class_name, $magic_params = array() X-Ref |
| self :: findFirst() convenience alias param: string class name of the object param: mixed misc magic params return: object|null |
| _findFirst($params) X-Ref |
| Userland filter for findFirst() static method param: mixed misc magic params return: object|null |
| findById($class_name, $id, $throw_exception = true, $conn = null) X-Ref |
| Finds one instance of object in database using object id, this method is actually a wrapper around find() param: string class name of the object param: integer object id param: object database connection object return: object|null |
| _findById($id, $throw_exception) X-Ref |
| Userland filter for findById() static method param: integer object id return: object |
| findByIds($class_name, $ids, $params = array() X-Ref |
| Finds a collection of objects in database using array of object ids, this method is actually a wrapper around find() param: string class name of the object param: array object ids param: mixed misc magic params param: object database connection object return: iterator |
| _findByIds($ids, $params = array() X-Ref |
| Userland filter for findByIds() static method param: array object ids param: mixed misc magic params return: iterator |
| getDataset($magic_params = array() X-Ref |
| Implements WACT template datasource component interface, this method simply calls find() param: mixed misc magic params return: iterator |
| findBySql($class_name, $sql, $conn = null) X-Ref |
| Finds a collection of objects in database using raw SQL param: string class name of the object param: string SQL param: object database connection object return: iterator |
| findFirstBySql($class_name, $sql, $conn = null) X-Ref |
| Finds first object in database using raw SQL param: string class name of the object param: string SQL param: object database connection object return: object |
| findOneBySql($class_name, $sql, $conn = null) X-Ref |
| Alias for findFirstBySql return: object |
| find($class_name, $magic_params = array() X-Ref |
| Generic objects finder. Using misc magic params it's possible to pass different search parameters. If passed as an array magic params can have the following properties: - <b>criteria</b> - apply specified criteria to collection can be a plain string or criteria object - <b>limit,offset</b> - apply limit,offset to collection - <b>sort</b> - sort collection by specified fields, e.g array('id' => 'desc', 'name' => 'asc') - <b>first</b> - return the first object of collection Some examples: <code> //generic way to find a collection of objects using magic params, //in this case we want collection: // - to match 'name="hey"' criteria // - ordered by 'id' property using descendant sort // - limited to 3 items $books = self :: find('Book', array('criteria' => 'name="hey"', 'sort' => array('id' => 'desc'), 'limit' => 3)); //returns a collection of all Book objects in database $books = self :: find('Book'); //returns one object with specified id $books = self :: find('Book', 1); //returns a collection of objects which match plain text criteria $books = self :: find('Book', 'name="hey"'); //returns a collection of objects which match criteria with placeholders $books = self :: find('Book', array('name=? and author=?', 'hey', 'bob')); //returns a collection of objects which match object criteria $books = self :: find('Book', new lmbSQLFieldCriteria('name', 'hey')); </code> param: string class name of the object param: mixed misc magic params param: object database connection object return: iterator |
| _find($params = array() X-Ref |
| Userland filter for find() static method param: mixed misc magic params return: iterator |
| findAllRecords($criteria = null, $sort_params = array() X-Ref |
| Finds a collection of records(not lmbActiveRecord objects!) from database table param: string|object filtering criteria param: array sort params return: iterator |
| addClassCriteria($criteria) X-Ref |
| Adds class name criterion to passed in criteria param: string|object criteria return: object |
| getInheritanceCondition() X-Ref |
| No description |
| _getInheritancePath() X-Ref |
| No description |
| decodeInheritancePath($path) X-Ref |
| No description |
| getInheritanceClass($obj) X-Ref |
| No description |
| loadById($id) X-Ref |
| Loads current object with data from database, overwrites any previous data, marks object dirty and unsets new status param: integer object id |
| loadFromRecord($record) X-Ref |
| Loads current object with data from database record, overwrites any previous data, marks object dirty and unsets new status param: object database record object |
| _setDbValue($key, $value) X-Ref |
| No description |
| _decodeDbValues($record) X-Ref |
| No description |
| getId() X-Ref |
| Returns id of object typecasted to integer explicitly return: integer |
| setId($id) X-Ref |
| Sets id of an object typecasted to integer explicitly, be carefull using this method since it may break relations if used improperly param: integer |
| getUpdateTime() X-Ref |
| No description |
| getCreateTime() X-Ref |
| No description |
| destroy() X-Ref |
| Destroys current object removing it from database as well, removes related objects if object was configured to do so. Throws exception if object doesn't have identity. |
| _deleteDbRecord() X-Ref |
| No description |
| delete($class_name, $criteria = null, $conn = null) X-Ref |
| Finds all objects which satisfy the passed criteria and destroys them one by one param: string class name param: string|object search criteria, if not set all objects are removed param: object database connection object |
| deleteRaw($class_name, $criteria = null, $conn = null) X-Ref |
| No description |
| updateRaw($class_name, $set, $criteria = null, $conn = null) X-Ref |
| No description |
| _getColumnsForSelect() X-Ref |
| No description |
| _removeOneToOneObjects() X-Ref |
| No description |
| _removeOneToManyObjects() X-Ref |
| No description |
| _removeManyToManyRecords() X-Ref |
| No description |
| _removeBelongsToRelations() X-Ref |
| No description |
| _createSQLStatement($sql) X-Ref |
| No description |
| _query($sql) X-Ref |
| No description |
| _execute($sql) X-Ref |
| No description |
| decorateRecordSet($rs, $class, $conn = null) X-Ref |
| Decorates database recordset with special decorator which converts each record into corresponding lmbActiveRecord object. param: iterator param: string wrapper class name param: object database connection object |
| _decorateRecordSet($rs) X-Ref |
| No description |
| __clone() X-Ref |
| No description |
| import($source) X-Ref |
| Imports magically data into object using relation info. This method is magic because it allows to import scalar data into objects. E.g: <code> //provided Book has Author many-to-one relation as 'author' property $book = new Book(); //will try load Author with id = 2 $book->import(array('title' => 'Alice in wonderand', 'author' => 2)); //should print '2' echo $book->getAuthor()->getId(); </code> param: array|object |
| importRaw($source) X-Ref |
| Plain import of data into object param: array |
| _canImportProperty($property) X-Ref |
| No description |
| _importCollection($property, $value, $class) X-Ref |
| No description |
| _importEntity($property, $value, $class) X-Ref |
| No description |
| _importValueObject($property, $obj) X-Ref |
| No description |
| export() X-Ref |
| Exports object data with lazy properties resolved return: array |
| exportRaw() X-Ref |
| Plain export of object data(lazy properties not included if not loaded) return: array |
| registerCallback($type, $callback) X-Ref |
| Registers instance listener of specified type param: integer call back type param: object call back object |
| registerOnBeforeSaveCallback($callback) X-Ref |
| No description |
| registerOnAfterSaveCallback($callback) X-Ref |
| No description |
| registerOnBeforeUpdateCallback($callback) X-Ref |
| No description |
| registerOnUpdateCallback($callback) X-Ref |
| No description |
| registerOnAfterUpdateCallback($callback) X-Ref |
| No description |
| registerOnBeforeCreateCallback($callback) X-Ref |
| No description |
| registerOnCreateCallback($callback) X-Ref |
| No description |
| registerOnAfterCreateCallback($callback) X-Ref |
| No description |
| registerOnBeforeDestroyCallback($callback) X-Ref |
| No description |
| registerOnAfterDestroyCallback($callback) X-Ref |
| No description |
| registerGlobalCallback($type, $callback) X-Ref |
| Registers global listener of specified type param: integer call back type param: object call back object |
| registerGlobalOnBeforeSaveCallback($callback) X-Ref |
| No description |
| registerGlobalOnAfterSaveCallback($callback) X-Ref |
| No description |
| registerGlobalOnBeforeUpdateCallback($callback) X-Ref |
| No description |
| registerGlobalOnUpdateCallback($callback) X-Ref |
| No description |
| registerGlobalOnAfterUpdateCallback($callback) X-Ref |
| No description |
| registerGlobalOnBeforeCreateCallback($callback) X-Ref |
| No description |
| registerGlobalOnCreateCallback($callback) X-Ref |
| No description |
| registerGlobalOnAfterCreateCallback($callback) X-Ref |
| No description |
| registerGlobalOnBeforeDestroyCallback($callback) X-Ref |
| No description |
| registerGlobalOnAfterDestroyCallback($callback) X-Ref |
| No description |
| _invokeListeners($type) X-Ref |
| No description |
| Generated: Sat Nov 22 03:48:54 2008 | Cross-referenced by PHPXref 0.7 |