private function setCollections(object $parent, array $collections, array $options) : void
    {
        $pathCollMap = [];
        $paths       = [];
        foreach ($collections as $coll) {
            [$propertyPath ]            = $this->getPathAndParent($coll);
            $pathCollMap[$propertyPath] = $coll;
            $paths[]                    = $propertyPath;
        }

        $paths = $this->excludeSubPaths($paths);
        /** @var PersistentCollectionInterface[] $setColls */
        $setColls   = array_intersect_key($pathCollMap, array_flip($paths));
        $setPayload = [];
        foreach ($setColls as $propertyPath => $coll) {
            $coll->initialize();
            $mapping                   = $coll->getMapping();
            $setData                   = $this->pb->prepareAssociatedCollectionValue(
                $coll,
                CollectionHelper::usesSet($mapping['strategy'])
            );
            $setPayload[$propertyPath] = $setData;
        }
        if (empty($setPayload)) {
            return;
        }

        $query = ['$set' => $setPayload];
        $this->executeQuery($parent, $query, $options);
    }
private function setCollections(object $parent, array $collections, array $options) : void
    {
        $pathCollMap = [];
        $paths       = [];
        foreach ($collections as $coll) {
            [$propertyPath ]            = $this->getPathAndParent($coll);
            $pathCollMap[$propertyPath] = $coll;
            $paths[]                    = $propertyPath;
        }

        $paths = $this->excludeSubPaths($paths);
        /** @var PersistentCollectionInterface[] $setColls */
        $setColls   = array_intersect_key($pathCollMap, array_flip($paths));
        $setPayload = [];
        foreach ($setColls as $propertyPath => $coll) {
            $coll->initialize();
            $mapping                   = $coll->getMapping();
            $setData                   = $this->pb->prepareAssociatedCollectionValue(
                $coll,
                CollectionHelper::usesSet($mapping['strategy'])
            );
            $setPayload[$propertyPath] = $setData;
        }
        if (empty($setPayload)) {
            return;
        }

        $query = ['$set' => $setPayload];
        $this->executeQuery($parent, $query, $options);
    }
private function setCollections ( object $ parent , array $ collections , array $ options ) : void { $ pathCollMap = [ ] ; $ paths = [ ] ; foreach ( $ collections as $ coll ) { [ $ propertyPath ] = $ this -> getPathAndParent ( $ coll ) ; $ pathCollMap [ $ propertyPath ] = $ coll ; $ paths [ ] = $ propertyPath ; } $ paths = $ this -> excludeSubPaths ( $ paths ) ; /** @var PersistentCollectionInterface[] $setColls */ $ setColls = array_intersect_key ( $ pathCollMap , array_flip ( $ paths ) ) ; $ setPayload = [ ] ; foreach ( $ setColls as $ propertyPath => $ coll ) { $ coll -> initialize ( ) ; $ mapping = $ coll -> getMapping ( ) ; $ setData = $ this -> pb -> prepareAssociatedCollectionValue ( $ coll , CollectionHelper :: usesSet ( $ mapping [ 'strategy' ] ) ) ; $ setPayload [ $ propertyPath ] = $ setData ; } if ( empty ( $ setPayload ) ) { return ; } $ query = [ '$set' => $ setPayload ] ; $ this -> executeQuery ( $ parent , $ query , $ options ) ; }
Sets a list of PersistentCollection instances.

This method is intended to be used with the "set" or "setArray"
strategies. The "setArray" strategy will ensure that the collections is
set as a BSON array, which means the collections elements will be
reindexed numerically before storage.

@param PersistentCollectionInterface[] $collections
@param array                           $options
Sets a list of PersistentCollection instances .