Skip to content

StorageList

Brownie edited this page Dec 13, 2017 · 1 revision

An example of a storage description with pre-known fields.

$storageList = new StorageList(array(
    'key1' => 'value1',
    'key2' => 'value2',
));

An example of a repository description with initialization of fields by input data.

class MyStorageList extends StorageList
{

    /**
     * Initializes and sets the list.
     */
    protected function initList()
    {
        $data = json_decode($this->getInitData(), true);
        $this->setList($data);
    }
}

$storageList = new MyStorageList('{"key1":"value1","key2":"value2"}');

Examples of using.

/**
 * Gets a value from the storage for supported field.
 */
$value = $storageList->get('key2');

Clone this wiki locally