-
Notifications
You must be signed in to change notification settings - Fork 0
StorageArray
Brownie edited this page Oct 25, 2017
·
3 revisions
class StorageArrayExample extends StorageArray
{
}Initializes the storage to supported fields.
$storageArrayExample = new StorageArrayExample(
array(
'id' => 10,
'isExample' => true,
'dateTime' => '2017-01-01 00:00:00',
'reason' => 'Test'
),
true
);class StorageArrayExample extends StorageArray
{
/**
* List of supported fields.
*
* @var array
*/
protected $fields = array(
'id' => null,
'isExample' => null,
'dateTime' => '2012-03-03 03:03:03',
'reason' => null
);
}Initializes the storage to supported fields.
$storageArrayExample = new StorageArrayExample(
array(
'id' => 20,
'isExample' => false,
'dateTime' => '2017-02-02 23:59:59',
'reason' => 'Example'
)
);/**
* Sets the value in the store for supported field.
*/
$storageArrayExample->setReason('Hello');
$storageArrayExample->setIsExample(true);/**
* Gets a value from the store for supported field.
*/
$reason = $storageArrayExample->getReason();
$isExample = $storageArrayExample->getIsExample();/**
* Gets the storage as an associative array.
*/
$storageToArray = $storageArrayExample->toArray();An exception "UndefinedMethodException" is thrown when accessing an unsupported field.