Overview

Namespaces

  • Charcoal
    • Loader
    • Model
      • Service
      • ServiceProvider
    • Source
      • Database
    • Validator

Classes

  • AbstractMetadata
  • AbstractModel
  • Collection
  • Model
  • ModelMetadata
  • ModelValidator

Interfaces

  • CollectionInterface
  • DescribableInterface
  • MetadataInterface
  • ModelInterface

Traits

  • DescribableTrait
  • Overview
  • Namespace
  • Class

Interface CollectionInterface

Defines a model collection.

Charcoal\Model\CollectionInterface implements ArrayAccess, Countable, IteratorAggregate

Direct known implementers

Charcoal\Model\Collection
Namespace: Charcoal\Model
Located at Charcoal/Model/CollectionInterface.php
Methods summary
public Charcoal\Model\CollectionInterface
# merge( array|Traversable $objs )

Merge the collection with the given objects.

Merge the collection with the given objects.

Parameters

$objs
Array of objects to append to this collection.

Returns

Charcoal\Model\CollectionInterface
public Charcoal\Model\CollectionInterface
# add( object $obj )

Add an object to the collection.

Add an object to the collection.

Parameters

$obj
An acceptable object.

Returns

Charcoal\Model\CollectionInterface
public object|null
# get( mixed $key )

Retrieve the object by primary key.

Retrieve the object by primary key.

Parameters

$key
The primary key.

Returns

object|null
The object or NULL if not in the collection.
public boolean
# has( string $key )

Determine if an object exists in the collection by key.

Determine if an object exists in the collection by key.

Parameters

$key
The primary key to lookup.

Returns

boolean
public Charcoal\Model\CollectionInterface
# remove( mixed $key )

Remove object from collection by primary key.

Remove object from collection by primary key.

Parameters

$key
The object primary key to remove.

Returns

Charcoal\Model\CollectionInterface
public Charcoal\Model\CollectionInterface
# clear( )

Remove all objects from collection.

Remove all objects from collection.

Returns

Charcoal\Model\CollectionInterface
public object[]
# all( )

Retrieve all objects in collection indexed by primary keys.

Retrieve all objects in collection indexed by primary keys.

Returns

object[]
An associative array of objects.
public object[]
# values( )

Retrieve all objects in the collection indexed numerically.

Retrieve all objects in the collection indexed numerically.

Returns

object[]
A sequential array of objects.
public array
# keys( )

Retrieve the primary keys of the objects in the collection.

Retrieve the primary keys of the objects in the collection.

Returns

array
A sequential array of keys.
Methods inherited from ArrayAccess
offsetExists(), offsetGet(), offsetSet(), offsetUnset()
Methods inherited from Countable
count()
Methods inherited from IteratorAggregate
getIterator()
API documentation generated by ApiGen