Methods summary
public
Charcoal\Source\StorableInterface
|
#
setId( mixed $id )
Set the object's ID. The actual property set depends on key()
Set the object's ID. The actual property set depends on key()
Parameters
- $id
- The object id (identifier / primary key value).
Returns
Throws
InvalidArgumentException If the argument is not scalar.
|
public
mixed
|
#
id( )
Get the object's (unique) ID. The actualy property get depends on key()
Get the object's (unique) ID. The actualy property get depends on key()
Returns
mixed
Throws
Exception If the set key is invalid.
|
public
Charcoal\Source\StorableInterface
|
#
setKey( string $key )
Set the key property.
Parameters
- $key
- The object key, or identifier "name".
Returns
Throws
InvalidArgumentException If the argument is not scalar.
|
public
string
|
#
key( )
Get the key property.
Returns
string
|
protected
Charcoal\Source\StorableInterface
|
#
setSourceFactory( Charcoal\Factory\FactoryInterface $factory )
Parameters
- $factory
- The source factory, which is useful to create source.
Returns
|
protected
Charcoal\Factory\FactoryInterface
|
#
sourceFactory( )
Returns
Charcoal\Factory\FactoryInterface
Throws
Exception If the source factory was not previously set.
|
public
Charcoal\Source\StorableInterface
|
|
public
Charcoal\Source\SourceInterface
|
#
source( )
Get the object's source.
Returns
|
abstract protected
Charcoal\Source\SourceInterface
|
#
createSource( )
Create the model's source, with the Source Factory.
Create the model's source, with the Source Factory.
Returns
|
public
Charcoal\Source\StorableInterface
|
#
load( mixed $id = null )
Load an object from the database from its ID.
Load an object from the database from its ID.
Parameters
- $id
- The identifier to load.
Returns
|
public
Charcoal\Source\StorableInterface
|
#
loadFrom( string $key = null, mixed $value = null )
Load an object from the database from its key $key.
Load an object from the database from its key $key.
Parameters
- $key
- Key pointing a column's name.
- $value
- Value of said column.
Returns
|
public
Charcoal\Source\StorableInterface
|
#
loadFromQuery( string $query, array $binds = [] )
Load an object from the database from a custom SQL query.
Load an object from the database from a custom SQL query.
Parameters
- $query
- The SQL query.
- $binds
- Optional. The SQL query parameters.
Returns
|
public
boolean
|
#
save( )
Save an object current state to storage
Save an object current state to storage
Returns
boolean
|
public
boolean
|
#
update( array $properties = null )
Update the object in storage to the current object state.
Update the object in storage to the current object state.
Parameters
- $properties
- If set, only update the properties specified in this array.
Returns
boolean
|
public
boolean
|
#
delete( )
Delete an object from storage.
Delete an object from storage.
Returns
boolean
|
protected
boolean
|
|
protected
boolean
|
|
protected
boolean
|
#
preUpdate( array $keys = null )
Parameters
- $keys
- Optional. The list of keys to update.
Returns
boolean
|
protected
boolean
|
#
postUpdate( array $keys = null )
Parameters
- $keys
- Optional. The list of keys to update.
Returns
boolean
|
protected
boolean
|
|
protected
boolean
|
|