Methods summary
public
|
#
__construct( array|ArrayAccess $dependencies )
Parameters
- $dependencies
- The class dependencies.
|
public
Charcoal\Source\AbstractSource
|
#
reset( )
Reset everything but the model.
Reset everything but the model.
Returns
|
public
Charcoal\Source\AbstractSource
|
#
setData( array $data )
Initialize the source's properties with an array of data.
Initialize the source's properties with an array of data.
Parameters
Returns
|
public
Charcoal\Source\AbstractSource
|
|
public
Charcoal\Model\ModelInterface
|
#
model( )
Return the source's Model.
Return the source's Model.
Returns
Throws
Exception If not model was previously set.
Implementation of
|
public
boolean
|
|
public
ColelectionLoader
|
#
setProperties( array $properties )
Set the properties of the source to fetch.
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.
Parameters
- $properties
- The properties.
Returns
ColelectionLoader Chainable
Implementation of
|
public
array
|
|
public
CollectionLoader
|
#
addProperty( string $property )
Parameters
- $property
- Property ident.
Returns
CollectionLoader Chainable
Throws
InvalidArgumentException If property is not a string or empty.
Implementation of
|
public
Collection
|
#
setFilters( array $filters )
Parameters
- $filters
- The filters to set.
Returns
Collection Chainable
Implementation of
|
public
array
|
#
filters( )
Returns
array
Implementation of
|
public
CollectionLoader
|
#
addFilter( string|array|Charcoal\Source\Filter $param, mixed $val = null, array $options = null )
Add a collection filter to the loader.
Add a collection filter to the loader.
There are 3 different ways of adding a filter:
- as a Filter object, in which case it will be added directly. - addFilter($obj);
- as an array of options, which will be used to build the Filter object - addFilter(['property' => 'foo', 'val' => 42, 'operator' => '<=']);
- as 3 parameters: property , val and options - addFilter('foo', 42, ['operator' => '<=']);
Parameters
- $param
- The filter property, or a Filter object / array.
- $val
- Optional: Only used if the first argument is a string.
- $options
- Optional: Only used if the first argument is a string.
Returns
CollectionLoader (Chainable)
Throws
InvalidArgumentException If property is not a string or empty.
Implementation of
|
protected
Charcoal\Source\FilterInterface
|
|
public
CollectionLoader
|
#
setOrders( array $orders )
Parameters
- $orders
- The orders to set.
Returns
CollectionLoader Chainable
Implementation of
|
public
array
|
#
orders( )
Returns
array
Implementation of
|
public
CollectionLoader
|
#
addOrder( string|array|Charcoal\Source\Order $param, string $mode = 'asc', array $orderOptions = null )
Parameters
- $param
- The order property, or an Order object / array.
- $mode
- Optional.
- $orderOptions
- Optional.
Returns
CollectionLoader Chainable
Throws
InvalidArgumentException If the param argument is invalid.
Implementation of
|
protected
Charcoal\Source\OrderInterface
|
|
public
CollectionLoader
|
#
setPage( integer $page )
Parameters
Returns
CollectionLoader Chainable
Throws
InvalidArgumentException If the page argument is not numeric.
Implementation of
|
public
integer
|
#
page( )
Returns
integer
Implementation of
|
public
CollectionLoader
|
#
setNumPerPage( integer $num )
Parameters
- $num
- The number of items to retrieve per page.
Returns
CollectionLoader Chainable
Throws
InvalidArgumentException If the num per page argument is not numeric.
Implementation of
|
public
integer
|
|
public
Charcoal\Source\SourceConfig
|
#
createConfig( array $data = null )
ConfigurableTrait > createConfig()
ConfigurableTrait > createConfig()
Parameters
Returns
|
abstract public
Charcoal\Source\StorableInterface
|
|
abstract public
array
|
|
abstract public
mixed
|
#
saveItem( Charcoal\Source\StorableInterface $item )
Save an item (create a new row) in storage.
Save an item (create a new row) in storage.
Parameters
- $item
- The object to save.
Returns
mixed The created item ID, or false in case of an error.
Implementation of
|
abstract public
boolean
|
#
updateItem( Charcoal\Source\StorableInterface $item, array $properties = null )
Update an item in storage.
Update an item in storage.
Parameters
- $item
- The object to update.
- $properties
- The list of properties to update, if not all.
Returns
boolean Success / Failure
Implementation of
|
abstract public
boolean
|
#
deleteItem( Charcoal\Source\StorableInterface $item = null )
Delete an item from storage
Delete an item from storage
Parameters
- $item
- Optional item to delete. If none, the current model object will be used..
Returns
boolean Success / Failure
Implementation of
|
protected
string
|
#
getter( string $key, string $case = 'camel' )
Allow an object to define how the key getter are called.
Allow an object to define how the key getter are called.
Parameters
- $key
- The key to get the getter from.
- $case
- Optional. The type of case to return. camel, pascal or snake.
Returns
string The getter method name, for a given key.
|
protected
string
|
#
setter( string $key, string $case = 'camel' )
Allow an object to define how the key setter are called.
Allow an object to define how the key setter are called.
Parameters
- $key
- The key to get the setter from.
- $case
- Optional. The type of case to return. camel, pascal or snake.
Returns
string The setter method name, for a given key.
|