• PHP reference
  • Sandbox
  • Storage

CollectionItem

class Sandbox\Storage\CollectionItem extends ArrayAccessibleObject

Class CollectionItem.

Item in a key-value storage collection.

Properties

array $data

The item's raw data.

integer $id

The collection item ID.

Methods

mixed __get(string $key)

Magic method __get.

Parameters

  • string $key The key data to retrieve

Return Value

  • mixed

__construct(Collection $collection, integer $id, array $value)

CollectionItem constructor.

Parameters

boolean|null|mixed field(string $key, mixed $value = null)

Update a field in the item, or get the value of the field by omitting the $value parameter.

Parameters

  • string $key
  • mixed $value

Return Value

  • boolean|null|mixed

boolean deleteField(string $key)

Remove a field in the item.

Parameters

  • string $key

Return Value

  • boolean

boolean update(mixed $value = '_____DEFAULT_VALUE_____')

Save the updated content of the item, or replace the full contents by passing them as a parameter.

Parameters

  • mixed $value

Return Value

  • boolean

boolean commit()

Save the updated content of the item. Alias for update() without parameters.

Return Value

  • boolean

See also

  • CollectionItem::update()

boolean delete()

Remove the item.

Return Value

  • boolean

Inherited from ArrayAccessibleObject

__set(string $key, mixed $value)

Assigns a value to the specified data.

Parameters

  • string $key The data key to assign the value to
  • mixed $value The value to set

boolean __isset(string $key)

Whether or not an data exists by key.

Parameters

  • string $key An data key to check for

Return Value

  • boolean

__unset(string $key)

Un-sets an data by key.

Parameters

  • string $key The key to unset

offsetSet(string $offset, mixed $value)

Assigns a value to the specified offset.

Parameters

  • string $offset The offset to assign the value to
  • mixed $value The value to set

boolean offsetExists(string $offset)

Whether or not an offset exists.

Parameters

  • string $offset An offset to check for

Return Value

  • boolean

offsetUnset(string $offset)

Un-sets an offset.

Parameters

  • string $offset The offset to unset

mixed offsetGet(string $offset)

Returns the value at specified offset.

Parameters

  • string $offset The offset to retrieve

Return Value

  • mixed