All beans extend the AbstractTDBMObject
class.
This class represents a bean. A bean is usually linked to one row in one table but can be linked to many rows in many
tables is DB inheritance is used (a primary key of one table is also a foreign key).
Therefore, a AbstractTDBMObject
object contains:
$dbRows
(A DbRow object represent a row in one table)
$status
: the status of the current objectA DbRow
object contains the following properties:
$dbRow
: the data contained by the object, as an array of column => value$primaryKeys
: the list of primary keys to access this object, as an array of column => value$status
: the status of the current objectAbstractTDBMObject
and DbRow
can have the following statuses:
TDBMObjectStateEnum::STATE_DETACHED
: when an object has been created with the new
keyword and is not yet
aware of the TDBMService
instance.
DbRow::$primaryKeys
: emptyTDBMService::$toSaveObjects
: noTDBMService::$objectStorage
: noTDBMObjectStateEnum::STATE_NEW
: when an object is known from TDBMService
but not yet stored in database.
This happens after calling the TDBMService->attach
method on a detached object.
DbRow::$primaryKeys
: emptyTDBMService::$toSaveObjects
: yesTDBMService::$objectStorage
: noTDBMObjectStateEnum::STATE_LOADED
: when an object has been loaded from TDBMService
and is not modified.
This happens after calling the TDBMService->getObject
for instance.
DbRow::$primaryKeys
: setTDBMService::$toSaveObjects
: noTDBMService::$objectStorage
: yesTDBMObjectStateEnum::STATE_DIRTY
: when an object has been loaded from TDBMService
and is modified.
This happens after calling the TDBMService->getObject
for instance, then calling a setter on the bean.
DbRow::$primaryKeys
: setTDBMService::$toSaveObjects
: yesTDBMService::$objectStorage
: yesTDBMObjectStateEnum::NOT_LOADED
: when an object has been lazy-loaded from TDBMService
and no getter has been
called on it.
DbRow::$primaryKeys
: setTDBMService::$toSaveObjects
: noTDBMService::$objectStorage
: yesTDBMObjectStateEnum::DELETED
: when an object has been deleted using TDBMService->delete
.
DbRow::$primaryKeys
: it depends on original state (before call to delete)TDBMService::$toSaveObjects
: noTDBMService::$objectStorage
: noFound a typo? Something is wrong in this documentation? Just fork and edit it!