public function update(object $parent, array $collections, array $options) : void
    {
        $setStrategyColls     = [];
        $addPushStrategyColls = [];

        foreach ($collections as $coll) {
            $mapping = $coll->getMapping();

            if ($mapping['isInverseSide']) {
                continue; // ignore inverse side
            }
            switch ($mapping['strategy']) {
                case ClassMetadata::STORAGE_STRATEGY_ATOMIC_SET:
                case ClassMetadata::STORAGE_STRATEGY_ATOMIC_SET_ARRAY:
                    throw new UnexpectedValueException($mapping['strategy'] . ' update collection strategy should have been handled by DocumentPersister. Please report a bug in issue tracker');

                case ClassMetadata::STORAGE_STRATEGY_SET:
                case ClassMetadata::STORAGE_STRATEGY_SET_ARRAY:
                    $setStrategyColls[] = $coll;
                    break;

                case ClassMetadata::STORAGE_STRATEGY_ADD_TO_SET:
                case ClassMetadata::STORAGE_STRATEGY_PUSH_ALL:
                    $addPushStrategyColls[] = $coll;
                    break;

                default:
                    throw new UnexpectedValueException('Unsupported collection strategy: ' . $mapping['strategy']);
            }
        }

        if (! empty($setStrategyColls)) {
            $this->setCollections($parent, $setStrategyColls, $options);
        }
        if (empty($addPushStrategyColls)) {
            return;
        }

        $this->deleteElements($parent, $addPushStrategyColls, $options);
        $this->insertElements($parent, $addPushStrategyColls, $options);
    }
public function update(object $parent, array $collections, array $options) : void
    {
        $setStrategyColls     = [];
        $addPushStrategyColls = [];

        foreach ($collections as $coll) {
            $mapping = $coll->getMapping();

            if ($mapping['isInverseSide']) {
                continue; // ignore inverse side
            }
            switch ($mapping['strategy']) {
                case ClassMetadata::STORAGE_STRATEGY_ATOMIC_SET:
                case ClassMetadata::STORAGE_STRATEGY_ATOMIC_SET_ARRAY:
                    throw new UnexpectedValueException($mapping['strategy'] . ' update collection strategy should have been handled by DocumentPersister. Please report a bug in issue tracker');

                case ClassMetadata::STORAGE_STRATEGY_SET:
                case ClassMetadata::STORAGE_STRATEGY_SET_ARRAY:
                    $setStrategyColls[] = $coll;
                    break;

                case ClassMetadata::STORAGE_STRATEGY_ADD_TO_SET:
                case ClassMetadata::STORAGE_STRATEGY_PUSH_ALL:
                    $addPushStrategyColls[] = $coll;
                    break;

                default:
                    throw new UnexpectedValueException('Unsupported collection strategy: ' . $mapping['strategy']);
            }
        }

        if (! empty($setStrategyColls)) {
            $this->setCollections($parent, $setStrategyColls, $options);
        }
        if (empty($addPushStrategyColls)) {
            return;
        }

        $this->deleteElements($parent, $addPushStrategyColls, $options);
        $this->insertElements($parent, $addPushStrategyColls, $options);
    }
public function update ( object $ parent , array $ collections , array $ options ) : void { $ setStrategyColls = [ ] ; $ addPushStrategyColls = [ ] ; foreach ( $ collections as $ coll ) { $ mapping = $ coll -> getMapping ( ) ; if ( $ mapping [ 'isInverseSide' ] ) { continue ; // ignore inverse side } switch ( $ mapping [ 'strategy' ] ) { case ClassMetadata :: STORAGE_STRATEGY_ATOMIC_SET : case ClassMetadata :: STORAGE_STRATEGY_ATOMIC_SET_ARRAY : throw new UnexpectedValueException ( $ mapping [ 'strategy' ] . ' update collection strategy should have been handled by DocumentPersister. Please report a bug in issue tracker' ) ; case ClassMetadata :: STORAGE_STRATEGY_SET : case ClassMetadata :: STORAGE_STRATEGY_SET_ARRAY : $ setStrategyColls [ ] = $ coll ; break ; case ClassMetadata :: STORAGE_STRATEGY_ADD_TO_SET : case ClassMetadata :: STORAGE_STRATEGY_PUSH_ALL : $ addPushStrategyColls [ ] = $ coll ; break ; default : throw new UnexpectedValueException ( 'Unsupported collection strategy: ' . $ mapping [ 'strategy' ] ) ; } } if ( ! empty ( $ setStrategyColls ) ) { $ this -> setCollections ( $ parent , $ setStrategyColls , $ options ) ; } if ( empty ( $ addPushStrategyColls ) ) { return ; } $ this -> deleteElements ( $ parent , $ addPushStrategyColls , $ options ) ; $ this -> insertElements ( $ parent , $ addPushStrategyColls , $ options ) ; }
Updates a list PersistentCollection instances deleting removed rows and inserting new rows.

@param PersistentCollectionInterface[] $collections
@param array                           $options
Updates a list PersistentCollection instances deleting removed rows and inserting new rows .