$filters
$filters : array
Array of `Filter` objects
Full implementation, as abstract class, of the SourceInterface.
$pagination : \Charcoal\Source\Pagination|null
The `Pagination` object
$model : \Charcoal\Model\ModelInterface
reset() : \Charcoal\Source\AbstractSource
Reset everything but the model.
Chainable
setData(array $data) : \Charcoal\Source\AbstractSource
Initialize the source's properties with an array of data.
array | $data | The source data. |
Chainable
setModel(\Charcoal\Model\ModelInterface $model) : \Charcoal\Source\AbstractSource
Set the source's Model.
\Charcoal\Model\ModelInterface | $model | The source's model. |
Chainable
model() : \Charcoal\Model\ModelInterface
Return the source's Model.
If not model was previously set.
setProperties(array $properties) : \Charcoal\Source\ColelectionLoader
Set the properties of the source to fetch.
This method accepts an array of property identifiers (property ident, as string) that will, if supported, be fetched from the source.
If no properties are set, it is assumed that all the Model's properties are to be fetched.
array | $properties | The properties. |
Chainable
addFilter(string|array|\Charcoal\Source\Filter $param, mixed $val = null, array $options = null) : \Charcoal\Source\CollectionLoader
Add a collection filter to the loader.
There are 3 different ways of adding a filter:
Filter
object, in which case it will be added directly.
addFilter($obj);
Filter
object
addFilter(['property' => 'foo', 'val' => 42, 'operator' => '<=']);
property
, val
and options
addFilter('foo', 42, ['operator' => '<=']);
string|array|\Charcoal\Source\Filter | $param | The filter property, or a Filter object / array. |
mixed | $val | Optional: Only used if the first argument is a string. |
array | $options | Optional: Only used if the first argument is a string. |
If property is not a string or empty.
(Chainable)
addOrder(string|array|\Charcoal\Source\Order $param, string $mode = 'asc', array $orderOptions = null) : \Charcoal\Source\CollectionLoader
string|array|\Charcoal\Source\Order | $param | The order property, or an Order object / array. |
string | $mode | Optional. |
array | $orderOptions | Optional. |
If the param argument is invalid.
Chainable
pagination() : \Charcoal\Source\Pagination
Get the pagination object.
If the pagination wasn't set previously, a new (default / blank) Pagination object will be created.
(Always return a PaginationInterface
object)
createConfig(array $data = null) : \Charcoal\Source\SourceConfig
ConfigurableTrait > createConfig()
array | $data | Optional. |
loadItem(mixed $ident, \Charcoal\Source\StorableInterface $item = null) : \Charcoal\Source\StorableInterface
mixed | $ident | The ID of the item to load. |
\Charcoal\Source\StorableInterface | $item | Optional item to load into. |
loadItems(\Charcoal\Source\StorableInterface|null $item = null) : array
\Charcoal\Source\StorableInterface|null | $item | The model to load items from. |
saveItem(\Charcoal\Source\StorableInterface $item) : mixed
Save an item (create a new row) in storage.
\Charcoal\Source\StorableInterface | $item | The object to save. |
The created item ID, or false in case of an error.
updateItem(\Charcoal\Source\StorableInterface $item, array $properties = null) : boolean
Update an item in storage.
\Charcoal\Source\StorableInterface | $item | The object to update. |
array | $properties | The list of properties to update, if not all. |
Success / Failure
deleteItem(\Charcoal\Source\StorableInterface $item = null) : boolean
Delete an item from storage
\Charcoal\Source\StorableInterface | $item | Optional item to delete. If none, the current model object will be used.. |
Success / Failure
createFilter() : \Charcoal\Source\FilterInterface
createOrder() : \Charcoal\Source\OrderInterface
createPagination() : \Charcoal\Source\PaginationInterface
getter(string $key, string $case = 'camel') : string
Allow an object to define how the key getter are called.
string | $key | The key to get the getter from. |
string | $case | Optional. The type of case to return. camel, pascal or snake. |
The getter method name, for a given key.
setter(string $key, string $case = 'camel') : string
Allow an object to define how the key setter are called.
string | $key | The key to get the setter from. |
string | $case | Optional. The type of case to return. camel, pascal or snake. |
The setter method name, for a given key.