API Documentation

Zend/Dojo/Data.php

Show: inherited
Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Dojo  
Version
$Id: Data.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Dojo_Data

Package: Zend\Dojo

dojo.data support for Zend Framework

Implements
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Uses
\ArrayAccess  
Uses
\Iterator  
Uses
\Countable  

Properties

Propertyprotectedstring|int  $_identifier= ''

Identifier field of item

Details
Type
stringint
Propertyprotectedarray  $_items= 'array()'

Collected items

Default valuearray()Details
Type
array
Propertyprotectedstring  $_label= ''

Label field of item

Details
Type
string
Propertyprotectedarray  $_metadata= 'array()'

Data container metadata

Default valuearray()Details
Type
array

Methods

methodpublic__construct( string|null $identifier = null, array|\Traversable|null $items = null, string|null $label = null ) : void

Constructor

Parameters
Name Type Description
$identifier string|null
$items array|\Traversable|null
$label string|null
methodpublic__toString( ) : string

Serialize to string (proxy to {@link toJson()})

Returns
Type Description
string
methodprotected_normalizeItem( array|object $item, string|int|null $id ) : array

Normalize an item to attach to the collection

Parameters
Name Type Description
$item array|object
$id string|int|null
Returns
Type Description
array
methodpublicaddItem( array|object $item, string|null $id = null ) : \Zend_Dojo_Data

Add an individual item, optionally by identifier

Parameters
Name Type Description
$item array|object
$id string|null
Returns
Type Description
\Zend_Dojo_Data
methodpublicaddItems( array|\Traversable $items ) : \Zend_Dojo_Data

Add multiple items at once

Parameters
Name Type Description
$items array|\Traversable
Returns
Type Description
\Zend_Dojo_Data
methodpublicclearItems( ) : \Zend_Dojo_Data

Remove all items at once

Returns
Type Description
\Zend_Dojo_Data
methodpublicclearMetadata( null|string $key = null ) : \Zend_Dojo_Data

Clear individual or all metadata item(s)

Parameters
Name Type Description
$key null|string
Returns
Type Description
\Zend_Dojo_Data
methodpubliccount( ) : int

Countable: how many items are present

Returns
Type Description
int
methodpubliccurrent( ) : array

Iterator: get current value

Returns
Type Description
array
methodpublicfromArray( array $data ) : \Zend_Dojo_Data

Load object from array

Parameters
Name Type Description
$data array
Returns
Type Description
\Zend_Dojo_Data
methodpublicfromJson( string $json ) : \Zend_Dojo_Data

Load object from JSON

Parameters
Name Type Description
$json string
Returns
Type Description
\Zend_Dojo_Data
methodpublicgetIdentifier( ) : string|int|null

Retrieve current item identifier

Returns
Type Description
string|int|null
methodpublicgetItem( string $id ) : array

Retrieve an item by identifier

Item retrieved will be flattened to an array.

Parameters
Name Type Description
$id string
Returns
Type Description
array
methodpublicgetItems( ) : array

Get all items as an array

Serializes items to arrays.

Returns
Type Description
array
methodpublicgetLabel( ) : string|null

Retrieve item association label

Returns
Type Description
string|null
methodpublicgetMetadata( null|string $key = null ) : mixed

Get metadata item or all metadata

Parameters
Name Type Description
$key null|string

Metadata key when pulling single metadata item

Returns
Type Description
mixed
methodpublichasItem( string|int $id ) : bool

Does an item with the given identifier exist?

Parameters
Name Type Description
$id string|int
Returns
Type Description
bool
methodpublickey( ) : string|int

Iterator: get current key

Returns
Type Description
string|int
methodpublicnext( ) : void

Iterator: get next item

methodpublicoffsetExists( string|int $offset ) : bool

ArrayAccess: does offset exist?

Parameters
Name Type Description
$offset string|int
Returns
Type Description
bool
methodpublicoffsetGet( string|int $offset ) : array

ArrayAccess: retrieve by offset

Parameters
Name Type Description
$offset string|int
Returns
Type Description
array
methodpublicoffsetSet( string $offset, array|object|null $value ) : void

ArrayAccess: set value by offset

Parameters
Name Type Description
$offset string
$value array|object|null
methodpublicoffsetUnset( string $offset ) : void

ArrayAccess: unset value by offset

Parameters
Name Type Description
$offset string
methodpublicremoveItem( string $id ) : \Zend_Dojo_Data

Remove item by identifier

Parameters
Name Type Description
$id string
Returns
Type Description
\Zend_Dojo_Data
methodpublicrewind( ) : void

Iterator: rewind to first value in collection

methodpublicsetIdentifier( string|int|null $identifier ) : \Zend_Dojo_Data

Set identifier for item lookups

Parameters
Name Type Description
$identifier string|int|null
Returns
Type Description
\Zend_Dojo_Data
methodpublicsetItem( array|object $item,  $id = null ) : \Zend_Dojo_Data

Set an individual item, optionally by identifier (overwrites)

Parameters
Name Type Description
$item array|object
$id
Returns
Type Description
\Zend_Dojo_Data
methodpublicsetItems( array|\Traversable $items ) : \Zend_Dojo_Data

Set the items to collect

Parameters
Name Type Description
$items array|\Traversable
Returns
Type Description
\Zend_Dojo_Data
methodpublicsetLabel( string|null $label ) : \Zend_Dojo_Data

Set label to use for displaying item associations

Parameters
Name Type Description
$label string|null
Returns
Type Description
\Zend_Dojo_Data
methodpublicsetMetadata( string|array $spec, mixed $value = null ) : \Zend_Dojo_Data

Set metadata by key or en masse

Parameters
Name Type Description
$spec string|array
$value mixed
Returns
Type Description
\Zend_Dojo_Data
methodpublictoArray( ) : array

Seralize entire data structure, including identifier and label, to array

Returns
Type Description
array
methodpublictoJson( ) : string

Serialize to JSON (dojo.data format)

Returns
Type Description
string
methodpublicvalid( ) : bool

Iterator: is item valid?

Returns
Type Description
bool
Documentation was generated by DocBlox 0.15.1.