Acts as a controller between domain objects, the SQL expression language, and
the RDBMS Engine layer. Manages queuing of work and transactions
Methods summary
public
|
|
public
Alchemy\util\Promise
|
#
add( Alchemy\orm\DataMapper $obj )
Add a new domain object to the session
Add a new domain object to the session
Parameters
Returns
Alchemy\util\Promise Resolved when INSERT is sent to the database
|
public
|
|
public
|
|
public
Alchemy\orm\DDL
|
#
ddl( )
Returns a DDL object for this session
Returns a DDL object for this session
Returns
|
public
Alchemy\engine\IEngine
|
#
engine( )
Return the Engine associated with this session
Return the Engine associated with this session
Returns
|
public
array
|
#
execute( string $cls, Query $query )
Execute a query, wrap the results in the given class and return a set.
Execute a query, wrap the results in the given class and return a set.
Parameters
- $cls
string $cls Class Name of a DataMapper subclass
- $query
Query $query Query to execute
Returns
array Set of Objects
|
public
|
#
flush( )
Start a new transaction (if one isn't already open), and flushes all pending
queries to the RDBMS in the order they were created. Leaves the transaction open
for you to commit / rollback.
Start a new transaction (if one isn't already open), and flushes all pending
queries to the RDBMS in the order they were created. Leaves the transaction open
for you to commit / rollback.
|
protected
array
|
#
getPrimaryKey( string $cls, array $record = array() )
Get the primary key for the given class and record. If one doesn't exist yet,
it generates a transient key to be used until the database allocates the object
a real key.
Get the primary key for the given class and record. If one doesn't exist yet,
it generates a transient key to be used until the database allocates the object
a real key.
Parameters
- $cls
string $cls Class Name of a DataMapper subclass
- $record
array $record Data Record
Returns
array
|
public
mixed
&
|
#
getProperty( string $cls, mixed $id, string $prop )
Return a reference to the given field
Return a reference to the given field
Parameters
- $cls
string $cls Class Name
- $id
mixed $id Record ID
- $prop
string $prop Column Name
Returns
mixed
|
public
Alchemy\orm\DataMapper
|
#
object( string $cls, string $sid )
Get an object from the session store without running a query.
Get an object from the session store without running a query.
Parameters
- $cls
string $cls DataMapper type
- $sid
string $sid SessionID
Returns
|
public
Alchemy\orm\SessionSelect
|
#
objects( mixed $cls )
Return a SessionSelect for the given class
Return a SessionSelect for the given class
Returns
|
public
Alchemy\util\Promise
|
#
remove( Alchemy\orm\DataMapper & $obj )
Delete the given object form the database
Delete the given object form the database
Returns
Alchemy\util\Promise resolved when DELETE statement is run
|
public
Alchemy\util\Promise
|
#
save( string $cls, mixed $id )
Queue an UPDATE query to be run later to update values set with Alchemy\orm\Session::setProperty()
Parameters
- $cls
string $cls Class Name
- $id
mixed $id Record ID
Returns
Alchemy\util\Promise Resolved when the query is run
|
public
|
#
setProperty( string $cls, mixed $id, string $prop, mixed $value )
Update a property value
Parameters
- $cls
string $cls Class Name
- $id
mixed $id Record ID
- $prop
string $prop Column Name
- $value
mixed $value Property Value
|
public
|
#
updatePrimaryKey( Alchemy\orm\DataMapper $obj, mixed $oldID, mixed $newID )
Accepts an object and moves it from one primary key to a new primary key.
This is only ever needed when migrating from a transient key to a real
db-allocated key after an INSERT.
Accepts an object and moves it from one primary key to a new primary key.
This is only ever needed when migrating from a transient key to a real
db-allocated key after an INSERT.
Parameters
|
protected
|
#
wrap( string $cls, array $rows )
Wrap a set of rows in the given DataMapper class
Wrap a set of rows in the given DataMapper class
Parameters
- $cls
string $cls Class Name
- $rows
array $rows Two-dimensional array of records
|