PHP Class Bolt\Storage\Collection\Relations

Author: Ross Riley ([email protected])
Inheritance: extends Doctrine\Common\Collections\ArrayCollection
Show file Open project: bolt/bolt

Protected Properties

Property Type Description
$em

Public Methods

Method Description
__construct ( array $elements = [], EntityManager $em = null ) Relations constructor.
getField ( string $fieldName, boolean $biDirectional = false, string $contentTypeName = null, integer $contentTypeId = null ) : Relations Gets a specific relation type name from the overall collection
getOriginal ( Bolt\Storage\Entity\Relations $entity ) : mixed | null This loops over the existing collection to see if the properties in the incoming are already available on a saved record. To do this it checks the four key properties if there's a match it returns the original, otherwise it returns the new and adds the new one to the collection.
incoming ( Content $entity ) : mixed Identifies which relations are incoming to the given entity
offsetGet ( $offset ) Overrides the default to allow fetching a sub-selection.
setEntityManager ( EntityManager $em )
setFromDatabaseValues ( array $result )
setFromPost ( array $formValues, Content $entity )
update ( Relations $collection ) : array Runs a check on an incoming collection to make sure that duplicates are filtered out. Precedence is given to records that are already persisted, with any diff in incoming properties updated.

Method Details

__construct() public method

Relations constructor.
public __construct ( array $elements = [], EntityManager $em = null )
$elements array
$em Bolt\Storage\EntityManager

getField() public method

Gets a specific relation type name from the overall collection
public getField ( string $fieldName, boolean $biDirectional = false, string $contentTypeName = null, integer $contentTypeId = null ) : Relations
$fieldName string
$biDirectional boolean
$contentTypeName string
$contentTypeId integer
return Relations

getOriginal() public method

This loops over the existing collection to see if the properties in the incoming are already available on a saved record. To do this it checks the four key properties if there's a match it returns the original, otherwise it returns the new and adds the new one to the collection.
public getOriginal ( Bolt\Storage\Entity\Relations $entity ) : mixed | null
$entity Bolt\Storage\Entity\Relations
return mixed | null

incoming() public method

Identifies which relations are incoming to the given entity
public incoming ( Content $entity ) : mixed
$entity Bolt\Storage\Entity\Content
return mixed

offsetGet() public method

public offsetGet ( $offset )

setEntityManager() public method

public setEntityManager ( EntityManager $em )
$em Bolt\Storage\EntityManager

setFromDatabaseValues() public method

public setFromDatabaseValues ( array $result )
$result array

setFromPost() public method

public setFromPost ( array $formValues, Content $entity )
$formValues array
$entity Bolt\Storage\Entity\Content

update() public method

Any records not in the incoming set are deleted from the collection and the deleted ones returned as an array.
public update ( Relations $collection ) : array
$collection Relations
return array

Property Details

$em protected property

protected $em