PHP Trait Sulu\Component\Persistence\RelationTrait

Show file Open project: sulu/sulu

Public Methods

Method Description
compareData ( $entities, array $requestEntities, callable $compare = null, callable $add = null, callable $update = null, callable $delete = null ) : boolean function compares entities with data of array and makes callback.
compareEntitiesWithData ( Traversable $entities, array $requestEntities, callable $compare, callable $add = null, callable $update = null, callable $delete = null ) : boolean Compares entities with data array and calls the given callbacks.
processSubEntities ( Traversable $entities, array $requestEntities, callable $get, callable $add = null, callable $update = null, callable $delete = null ) : boolean This method processes a put request (delete non-existing entities, update existing entities, add new entries), and let the single actions be modified by callbacks.

Protected Methods

Method Description
findMatchByCallback ( $entity, array $requestEntities, callable $compare, array &$matchedEntry, string &$matchedKey ) Applies a given compare function to a given set of data entries. Returns the entity itself and its key with the $matchedEntry and $matchKey parameters.

Method Details

compareData() public method

function compares entities with data of array and makes callback.
public compareData ( $entities, array $requestEntities, callable $compare = null, callable $add = null, callable $update = null, callable $delete = null ) : boolean
$entities
$requestEntities array
$compare callable
$add callable
$update callable
$delete callable
return boolean

compareEntitiesWithData() public method

Compares entities with data array and calls the given callbacks.
public compareEntitiesWithData ( Traversable $entities, array $requestEntities, callable $compare, callable $add = null, callable $update = null, callable $delete = null ) : boolean
$entities Traversable The list of entities to work on
$requestEntities array The entities as retrieved from the request
$compare callable return true if data matches entity
$add callable
$update callable
$delete callable
return boolean

findMatchByCallback() protected method

Applies a given compare function to a given set of data entries. Returns the entity itself and its key with the $matchedEntry and $matchKey parameters.
protected findMatchByCallback ( $entity, array $requestEntities, callable $compare, array &$matchedEntry, string &$matchedKey )
$entity The entity to compare
$requestEntities array The set of entities to search in
$compare callable Compare function, which defines if data matches the entity
$matchedEntry array
$matchedKey string

processSubEntities() public method

This method processes a put request (delete non-existing entities, update existing entities, add new entries), and let the single actions be modified by callbacks.
public processSubEntities ( Traversable $entities, array $requestEntities, callable $get, callable $add = null, callable $update = null, callable $delete = null ) : boolean
$entities Traversable The list of entities to work on
$requestEntities array The entities as retrieved from the request
$get callable Return id of entity
$add callable
$update callable
$delete callable
return boolean