src/Sulu/Component/Persistence/RelationTrait.php
public function compareEntitiesWithData(
        $entities,
        array $requestEntities,
        callable $compare,
        callable $add = null,
        callable $update = null,
        callable $delete = null
    ) {
        // define a matching function
        $matchFunction = function($entity, $requestEntities, &$matchedEntry, &$matchedKey) use ($compare) {
            $this->findMatchByCallback($entity, $requestEntities, $compare, $matchedEntry, $matchedKey);
        };

        return $this->compareData($entities, $requestEntities, $matchFunction, $add, $update, $delete);
    }
public function compareEntitiesWithData(
        $entities,
        array $requestEntities,
        callable $compare,
        callable $add = null,
        callable $update = null,
        callable $delete = null
    ) {
        // define a matching function
        $matchFunction = function($entity, $requestEntities, &$matchedEntry, &$matchedKey) use ($compare) {
            $this->findMatchByCallback($entity, $requestEntities, $compare, $matchedEntry, $matchedKey);
        };

        return $this->compareData($entities, $requestEntities, $matchFunction, $add, $update, $delete);
    }
public function compareEntitiesWithData ( $ entities , array $ requestEntities , callable $ compare , callable $ add = null , callable $ update = null , callable $ delete = null ) { // define a matching function $ matchFunction = function ( $ entity , $ requestEntities , & $ matchedEntry , & $ matchedKey ) use ( $ compare ) { $ this -> findMatchByCallback ( $ entity , $ requestEntities , $ compare , $ matchedEntry , $ matchedKey ) ; } ; return $ this -> compareData ( $ entities , $ requestEntities , $ matchFunction , $ add , $ update , $ delete ) ; }
Compares entities with data array and calls the given callbacks.

@param Traversable $entities The list of entities to work on
@param array $requestEntities The entities as retrieved from the request
@param callable $compare return true if data matches entity
@param callable $add
@param callable $update
@param callable $delete

@return bool
Compares entities with data array and calls the given callbacks .