Home  Support  API

IOrmEntityAccessor Interface Reference
[Dao]


Contract for accessing IdentifiableOrmEntity.

TODO drop{by}() method family

Definition at line 26 of file IOrmEntityAccessor.class.php.

Inheritance diagram for IOrmEntityAccessor:
Inheritance graph

List of all members.

Public Member Functions

 dropEntityById ($id)
 Drops the IdentifiableOrmEntity object by id from the database.
 executeQuery (ISqlQuery $query)
 Executes a query against the entity's database and returns the number of affected rows.
 getByIds (array $ids)
 Gets the set of IdentifiableOrmEntity objects by their identifiers.
 getCell (ISqlSelectQuery $query)
 Gets a raw database value of a cell.
 getColumn (ISqlSelectQuery $query)
 Gets a set of raw database values of a specific cell.
 getEntity (ISqlSelectQuery $query)
 Gets the IdentifiableOrmEntity object by query.
 getEntityById ($id)
 Gets the IdentifiableOrmEntity object by id.
 getLazyEntityById ($id)
 Gets an IdentifiableOrmEntity object by id without fetching it from the DB (if not yet fetched).
 getList (ISqlSelectQuery $query=null)
 Gets the set IdentifiableOrmEntity objects by query.
 getProperty ($property, ISqlSelectQuery $query)
 Gets an entity property mapped from a the database cells of a specific tuple.
 getPropertyList ($property, ISqlSelectQuery $query=null)
 Gets a set of entity properties mapped from a set of raw database cells.
 getRow (ISqlSelectQuery $query)
 Gets a tuple of raw database values.
 getRows (ISqlSelectQuery $query=null)
 Gets a set of tuples of raw database values.
 saveEntity (IdentifiableOrmEntity $entity)
 Save the IdentifiableOrmEntity object to the database.

Member Function Documentation

IOrmEntityAccessor::dropEntityById ( id  ) 

Drops the IdentifiableOrmEntity object by id from the database.

This method does not perform a check whether the IdentifiableOrmEntity is presented in the database or not, but returns a boolean result specifying whether the drop has affection on object (if it was presented) or not.

Parameters:
mixed $id
Returns:
boolean whether the drop has affection on object (if it was presented) or not.

Implemented in RdbmsDao.

IOrmEntityAccessor::executeQuery ( ISqlQuery query  ) 

Executes a query against the entity's database and returns the number of affected rows.

Parameters:
ISqlQuery $query query to execute
Returns:
int number of affected rows, or NULL if query has no affect on rows

Implemented in RdbmsDao.

IOrmEntityAccessor::getByIds ( array $  ids  ) 

Gets the set of IdentifiableOrmEntity objects by their identifiers.

Note that if some objects where not found, they silently won't be presented in the resulting set. No exception is thrown in this case (which is not similar to IOrmEntityAccessor::getById() logic).

The resulting set is an associate array of identifiable objects where keys are identifiers casted to strings.

Also not that this method DOES NOT GUARANTEE to return a set of objects in a order defined by the set of identifiers.

Parameters:
array $ids associative array of identifiable objects

Implemented in RdbmsDao.

IOrmEntityAccessor::getCell ( ISqlSelectQuery query  ) 

Gets a raw database value of a cell.

The resulting value is not mapped to any of entity properties. For straight mapping see IOrmEntityAccessor::getProperty()

Warning:
A query MUST define only a single database column to be retrieved because only the first found cell is used as the resulting value.
A query MUST be able to limit the resulting rows count to a signle tuple (see ISqlSelectQuery::setLimit()).
Exceptions:
CellNotFoundException thrown when no tuples where retrieved by the query. We cannot return NULL or FALSE because these values may be a valid values of the cell
Parameters:
ISqlSelectQuery $query query to execute
Returns:
mixed a cell's raw value

Implemented in RdbmsDao.

IOrmEntityAccessor::getColumn ( ISqlSelectQuery query  ) 

Gets a set of raw database values of a specific cell.

The resulting value is not mapped to any of entity properties. For straight mapping see IOrmEntityAccessor::getPropertyList()

Warning:
A query MUST define only a single database column to retrieve because only the first found cell is used as the resulting value.
A query MUST be able to limit the resulting rows count to a signle tuple (see ISqlSelectQuery::setLimit()).
Parameters:
ISqlSelectQuery $query query to execute
Returns:
array an array of raw values of a specific cell

Implemented in RdbmsDao.

IOrmEntityAccessor::getEntity ( ISqlSelectQuery query  ) 

Gets the IdentifiableOrmEntity object by query.

Warning:
A query MUST define for retrieval at least all those database columns that are needed to assemble an entity
A query MUST be able to limit the resulting rows count to a signle tuple (see ISqlSelectQuery::setLimit()).
Exceptions:
OrmEntityNotFoundException thrown when entity is not presented in the DB
Parameters:
ISqlSelectQuery $query query to execute
Returns:
IdentifiableOrmEntity

Implemented in RdbmsDao.

IOrmEntityAccessor::getEntityById ( id  ) 

Gets the IdentifiableOrmEntity object by id.

Entity assembling is performed according to the currently set FetchStrategy.

Exceptions:
OrmEntityNotFoundException thrown when entity is not presented in the DB
Parameters:
mixed $id
Returns:
IdentifiableOrmEntity

Implemented in RdbmsDao.

IOrmEntityAccessor::getLazyEntityById ( id  ) 

Gets an IdentifiableOrmEntity object by id without fetching it from the DB (if not yet fetched).

This method is optimized for assembling, i.e. if identified entity was fetched earlier then it would be used as the resulting object.

The returned entity can be assembled with actual values using IdentifiableOrmEntity::fetch() method.

Note that this method does not check the existance of an entity in the DB.

Parameters:
mixed $id
Returns:
IdentifiableOrmEntity

Implemented in RdbmsDao.

IOrmEntityAccessor::getList ( ISqlSelectQuery query = null  ) 

Gets the set IdentifiableOrmEntity objects by query.

If query is not presented then ALL possible objects are fetched.

Warning:
A query MUST define for retrieval at least all those database columns that are needed to assemble an entity
Parameters:
ISqlSelectQuery $query optinal query to execute
Returns:
array set of IdentifiableOrmEntity objects

Implemented in RdbmsDao.

IOrmEntityAccessor::getProperty ( property,
ISqlSelectQuery query 
)

Gets an entity property mapped from a the database cells of a specific tuple.

Warning:
A query MUST define for retrieval at least all those database columns that are needed to assemble an entity
A query MUST be able to limit the resulting rows count to a signle tuple (see ISqlSelectQuery::setLimit()).
Parameters:
string $property name of an entity property
ISqISqlSelectQuery $query query to execute
Returns:
mixed an OrmPropertyType-mapped value

Implemented in RdbmsDao.

IOrmEntityAccessor::getPropertyList ( property,
ISqlSelectQuery query = null 
)

Gets a set of entity properties mapped from a set of raw database cells.

If query is not presented then a resulting property set would be collected from ALL objectes presented in the DB.

Warning:
A query MUST define for retrieval at least all those database columns that are needed to assemble an entity
Parameters:
string $property name of an entity property
ISqISqlSelectQuery $query query to execute
Returns:
mixed an array of OrmPropertyType-mapped values

Implemented in RdbmsDao.

IOrmEntityAccessor::getRow ( ISqlSelectQuery query  ) 

Gets a tuple of raw database values.

Values presented in the resulting tuple are not mapped to an entity properties. For the straight mapping see IOrmEntityAccessor::getProperty()

Warning:
A query MUST be able to limit the resulting rows count to a signle tuple (see ISqlSelectQuery::setLimit()).
Exceptions:
RowNotFoundException thrown when no tuples where retrieved by the query. We actually can return NULL or FALSE because a tuple can be presented as array only, but we throw an explicit exception to be similar with IOrmEntityAccessor::getCell() method
Parameters:
ISqlSelectQuery $query query to execute
Returns:
associative array that represents a tuple of raw database values

Implemented in RdbmsDao.

IOrmEntityAccessor::getRows ( ISqlSelectQuery query = null  ) 

Gets a set of tuples of raw database values.

Values presented in the resulting tuples are not mapped to an entity properties.

If query is not presented then ALL tuples are retrieved.

Parameters:
ISqlSelectQuery $query query to execute
Returns:
array an array of associative arrays that represent a tuples of raw database values

Implemented in RdbmsDao.

IOrmEntityAccessor::saveEntity ( IdentifiableOrmEntity entity  ) 

Save the IdentifiableOrmEntity object to the database.

If entity's ID is not set then an entity is treated as a newly created object and a new tuple is inserted in the database.

Otherwise,

Parameters:
IdentifiableOrmEntity $entity entity to save
Returns:
boolean

Implemented in RdbmsDao.


The documentation for this interface was generated from the following file: