Class CollectionObject
A collection object. All collection classes must
inherit this. It provides methods to lookup, serialize
and put contents in a collection. Collections
can represent any extended class where
any of those listed in models. does not have an implemention for @class Media
Direct known subclasses
Catapult\ApplicationCollection,
Catapult\CallCollection,
Catapult\MediaCollection,
Catapult\MessageCollection,
Catapult\PhoneNumbersCollection,
Catapult\RecordingCollection,
Catapult\TransactionCollection,
Catapult\TranscriptionCollection,
Catapult\UserErrorCollection,
Catapult\CallEventsCollection,
Catapult\CollectionIterator,
Catapult\CollectionSequence,
Catapult\DomainsCollection,
Catapult\EndpointsCollection,
Catapult\EndpointsMulti,
Catapult\EventCollection,
Catapult\GatherCollection
Namespace: Catapult
Class:
CollectionObject. Superset
of the collections. Provides auxilary functions
to manage, update and get elements within a collection
Located at core/Collections.php
Methods summary
public
|
#
__construct( data $data = array(), $quiet = TRUE )
either pass in infomation as array
or datapacket collection identify each element key by its id
either pass in infomation as array
or datapacket collection identify each element key by its id
Parameters
- $data
- initial set of data
- $quiet
|
public
|
#
__toString( )
Serialize the collection object as a
JSON object.
Serialize the collection object as a
JSON object.
|
public
|
#
last( )
get the last item within
a set. This should always try to get the
last item when not found return a null
get the last item within
a set. This should always try to get the
last item when not found return a null
|
public
|
#
first( )
get the first item
within a set
get the first item
within a set
|
public
|
#
get( id: $id = null )
Get one item from the Collection
if item is not initiated, initiate it
Get one item from the Collection
if item is not initiated, initiate it
Parameters
- $id
- valid id inside this collection
|
public
|
#
setup( data: $d )
Setup the object. This is forward
to GenericRecource's load/1. It should add each
attribute in the provided set
Setup the object. This is forward
to GenericRecource's load/1. It should add each
attribute in the provided set
Parameters
|
public
|
#
add( data $data )
Before adding we must make sure the datapacket fits(schema)
support two fold init where
data can either be the initialized object
or raw array
Before adding we must make sure the datapacket fits(schema)
support two fold init where
data can either be the initialized object
or raw array
Parameters
- $data
- data that is valid for this collection
|
public
|
#
isEmpty( )
check if our data structure
is empty or not. should also
retun false when we have a string
check if our data structure
is empty or not. should also
retun false when we have a string
|
public
collectionsequence
|
#
find( id $terms, $absolute = TRUE )
get a specific entity
in the collection
get a specific entity
in the collection
Parameters
- $terms
- id for match
- $absolute
Returns
collectionsequence
|
public
|
#
reload( )
slow on performance. ONLY
use if absolutely needed
this will reload each item
in a collection, individually.
slow on performance. ONLY
use if absolutely needed
this will reload each item
in a collection, individually.
Where objects all must be initiated
and have get/1 ready with id
|
public
|
#
toArray( )
Collection based ToArray
should serialize each model into its
array
Collection based ToArray
should serialize each model into its
array
|
public
a
|
#
listIterator( )
iterator over the listing
object
iterator over the listing
object
Returns
a CollectionIterator
|
public
|
#
listAll( )
scenarios where the objects
has not been loaded yet
added: 2/4/2015.
Before:
PhoneNumber = new PhoneNumber
PhoneNUmbers = PhoneNumber->listAll
scenarios where the objects
has not been loaded yet
added: 2/4/2015.
Before:
PhoneNumber = new PhoneNumber
PhoneNUmbers = PhoneNumber->listAll
Now:
PhoneNumbers = new PhoneNumberCollection
PhoneNumbers->listAll
This should always make sure we dont
have data already
|