\Charcoal\SourceStorableInterface

Storable items can be stored and loaded from a Source.

Summary

Methods
Constants
setId()
id()
setKey()
key()
source()
load()
loadFrom()
loadFromQuery()
save()
update()
delete()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

setId()

setId(mixed  $id) : \Charcoal\Source\StorableInterface

Set the object's ID. The actual property set depends on `key()`

Parameters

mixed $id

The object's ID.

Returns

\Charcoal\Source\StorableInterface

Chainable

id()

id() : mixed

Get the object's (unique) ID. The actualy property get depends on `key()`

Returns

mixed

setKey()

setKey(string  $key) : \Charcoal\Source\StorableInterface

Set the key property.

Parameters

string $key

The object's key.

Returns

\Charcoal\Source\StorableInterface

Chainable

key()

key() : string

Get the key property.

Returns

string

load()

load(mixed  $id) : boolean

Load an object from the database from its ID.

Parameters

mixed $id

The ID of the object to load.

Returns

boolean —

Success / Failure

loadFrom()

loadFrom(string  $key = null, mixed  $value = null) : \Charcoal\Source\StorableInterface

Load an object from the database from its key $key.

Parameters

string $key

Key pointing a column's name.

mixed $value

Value of said column.

Returns

\Charcoal\Source\StorableInterface

Chainable.

loadFromQuery()

loadFromQuery(string  $query, array  $binds = array()) : \Charcoal\Source\StorableInterface

Load an object from the database from a custom SQL query.

Parameters

string $query

The SQL query.

array $binds

Optional. The SQL query parameters.

Returns

\Charcoal\Source\StorableInterface

Chainable.

save()

save() : boolean

Save an object current state to storage

Returns

boolean

update()

update(array<mixed,string>  $keys = null) : boolean

Update the object in storage to the current object state.

Parameters

array<mixed,string> $keys

If set, only update the properties specified in this array.

Returns

boolean

delete()

delete() : boolean

Delete an object from storage.

Returns

boolean