Abstract base class for custom ORM models. this class doesn't actually store
any data, it merely acts as an interface between Domain objects and the Session
(which actually owns all of the DB records).
Methods summary
public static
|
#
from_session( Alchemy\orm\Session $session, mixed $sessionID )
Instantiate a domain object from the session
Instantiate a domain object from the session
Parameters
- $session
Alchemy\orm\Session
$session The database session which owns this record
- $sessionID
mixed $sessionID A pointer to the record for this objects data in the session
|
public static
array
|
#
list_mappers( )
List all subclasses of DataMapper. Only works for classes already loaded by
PHP.
List all subclasses of DataMapper. Only works for classes already loaded by
PHP.
Returns
array
|
public static
|
#
register( )
Call immediately after data mapper definition
Call immediately after data mapper definition
|
public static
Alchemy\core\schema\Table
|
#
schema( )
Gen an instance of Table that represents the schema of this domain
object.
Gen an instance of Table that represents the schema of this domain
object.
Returns
|
public static
Alchemy\orm\ORMTableRef
|
#
table( )
Return a table reference for this model
Return a table reference for this model
Returns
|
public static
string
|
#
table_name( )
Get the table name for this mapper
Get the table name for this mapper
Returns
string Table Name
|
public
|
|
public
mixed
|
#
__get( string $prop )
Get the value of a column on this object
Get the value of a column on this object
Parameters
Returns
mixed
|
public
|
#
__set( string $prop, mixed $value )
Get the value of a column on this object. Nothing is actually written back to
the session until {@DataMapper::save()} is called.
Get the value of a column on this object. Nothing is actually written back to
the session until {@DataMapper::save()} is called.
Parameters
- $prop
string $prop Column Name
- $value
mixed $value
|
public
string
|
|
protected
|
#
addPersistanceDependancy( Alchemy\orm\DataMapper $obj )
Add an object to the list of objects that must be persisted before this
object can be persisted.
Add an object to the list of objects that must be persisted before this
object can be persisted.
Parameters
|
public
Alchemy\util\promise\Promise
|
|
public
array
|
#
getPrimaryKey( )
Return a set of values which represent this object's primary key.
Return a set of values which represent this object's primary key.
Returns
array
|
public
|
#
getRelatedSet( mixed $name )
Return a related set object by relationship name
Return a related set object by relationship name
|
public
Alchemy\orm\Session
|
#
getSession( )
Return the Session of this object
Return the Session of this object
Returns
|
public
string
|
#
getSessionID( )
Return the ID used to identify this objects record in the Session
Return the ID used to identify this objects record in the Session
Returns
string
|
public
boolean
|
#
isTransient( )
Return true if this model doesn't yet exist in the database
Return true if this model doesn't yet exist in the database
Returns
boolean
|
public
Alchemy\util\promise\Promise
|
#
onDependanciesPersisted( )
Return a promise resolved when all objects that this object references by
foreign key have been persisted
Return a promise resolved when all objects that this object references by
foreign key have been persisted
Returns
|
public
Alchemy\util\promise\Promise
|
#
onPersisted( )
Return a Promise for when this object is actually persisted, if it is not
already.
Return a Promise for when this object is actually persisted, if it is not
already.
Returns
|
public
|
#
rollback( )
Revert all unsaved changed to this model
Revert all unsaved changed to this model
|
public
|
#
save( boolean $queueUpdate = true )
Save this object's data back to the session. By default this will queue an
UPDATE statement to be run on the server as soon as {@Session::commit()} is
called.
Save this object's data back to the session. By default this will queue an
UPDATE statement to be run on the server as soon as {@Session::commit()} is
called.
Parameters
- $queueUpdate
boolean $queueUpdate Default's to true
|
public
|
#
set( array $map )
Set multiple properties on this object.
Set multiple properties on this object.
Parameters
- $map
array $map [Property => Value, ...]
|
public
|
#
setSession( Alchemy\orm\Session $session, string $sessionID, mixed $persisted = false )
Set the Session and Session pointer for this object
Set the Session and Session pointer for this object
Parameters
- $session
Alchemy\orm\Session
$session Session which owns this object
- $sessionID
string $sessionID Pointer to data record in $session
- $persisted
|