Sets a PersistentCollection instance.

This method is intended to be used with the "set" strategy.

@param PersistentCollectionInterface $coll
192156
private function setCollection(PersistentCollectionInterface $coll)
    {
        list($qb, $path, $parent) = $this->getQueryPathAndParent($coll);

        $coll->initialize();

        $path->set($coll);
        $this->executeQuery($qb, $parent);
    }
1186944
public function set(ItemInterface $item)
    {
        $id = $item->getId();
        $collectionName = $item->getCollection();

        $this->items[$id] = $item;

        if (isset($this->idCollections[$id]) && $this->idCollections[$id] !== $collectionName) {
            throw new \RuntimeException(sprintf('The item with id: "%s" has been registered previously with another collection.', $id));
        }

        if (isset($this->itemCollections[$collectionName]) === false) {
            $this->itemCollections[$collectionName] = [];
        }

        $this->itemCollections[$collectionName][$id] = $item;
        $this->idCollections[$id] = $collectionName;
    }
443759
public function set($collectionId, EntityCollectionInterface $collection)
    {
        $this->getCache()->set($collectionId, $collection);
        return $this;
    }
1135619
public function delete(PersistentCollectionInterface $coll)
    {
        $mapping = $coll->getMapping();
        if ($mapping->isInverseSide) {
            return; // ignore inverse side
        }
        if ($mapping->strategy === PropertyMetadata::STORAGE_STRATEGY_ATOMIC_SET) {
            throw new \UnexpectedValueException(sprintf('%s delete collection strategy should have been handled by DocumentPersister. Please report a bug in issue tracker', $mapping->strategy));
        }

        list($qb, $path, $parent) = $this->getQueryPathAndParent($coll);

        $path->remove();
        $this->executeQuery($qb, $parent);
    }
1347327
private function loadReferenceManyCollectionInverseSide(PersistentCollectionInterface $collection)
    {
        $query     = $this->createReferenceInverseSideQuery($collection->getMapping(), $collection->getOwner());
        $documents = $query->execute()->toArray();

        foreach ($documents as $key => $document) {
            $collection->add($document);
        }
    }
1305773
public function setKeepalive($bool)
    {
        $this->keepalive = (bool)$bool;
        $this->setOption(\EventUtil::SOL_SOCKET, \EventUtil::SO_KEEPALIVE, $this->keepalive ? true : false);
    }
1367586
public function delete(PersistentCollection $coll, array $options)
    {
        $mapping = $coll->getMapping();
        if ($mapping['isInverseSide']) {
            return; // ignore inverse side
        }
        list($propertyPath, $parent) = $this->getPathAndParent($coll);
        $query = array('$unset' => array($propertyPath => true));
        $this->executeQuery($parent, $query, $options);
    }
157978
public function persist(PersistenceContext $context, ParentChildMap $map)
    {
        /** @var Row[] $parentRows */
        $parentRows = [];
        /** @var object[] $children */
        $children = [];

        foreach ($map->getItems() as $key => $item) {
            $parentRow = $item->getParent();

            $hasChild = (bool)$item->getChild();
            if ($hasChild) {
                $parentRows[$key] = $parentRow;
                $children[$key]   = $item->getChild();
            }

            if ($this->objectIssetColumnName && !$this->isWithinValueObject) {
                $parentRow->setColumn($this->objectIssetColumnName, $hasChild);
            }
        }

        $this->disableLazyLoadingForRelations(function () use ($context, $children, $parentRows) {
            $this->mapper->persistAllToRows($context, $children, $parentRows);
        });
    }
289629
public function setCollection($collection)
    {
        $this->indexedContainer = $collection;

        foreach ($collection as $argModel) {
            $this->hashedContainer[$argModel->getName()] = $argModel;
        }

        return $this;
    }
521879
public void setCollection(String collection) {
        addField(ConfigureNodeFields.collection, FormField.Type.text_single);
        setAnswer(ConfigureNodeFields.collection.getFieldName(), collection);
    }
21131
private function addManyReferences(PersistentCollectionInterface $persistentCollection, array &$groupedIds) : void
    {
        $mapping   = $persistentCollection->getMapping();
        $class     = null;
        $className = null;

        if ($mapping['storeAs'] === ClassMetadata::REFERENCE_STORE_AS_ID) {
            $className = $mapping['targetDocument'];
            $class     = $this->dm->getClassMetadata($className);
        }

        foreach ($persistentCollection->getMongoData() as $reference) {
            $id = ClassMetadata::getReferenceId($reference, $mapping['storeAs']);

            if ($mapping['storeAs'] !== ClassMetadata::REFERENCE_STORE_AS_ID) {
                $className = $this->uow->getClassNameForAssociation($mapping, $reference);
                $class     = $this->dm->getClassMetadata($className);
            }

            if ($class === null) {
                continue;
            }

            $document = $this->uow->tryGetById($id, $class);

            if ($document && ! (($document instanceof GhostObjectInterface && ! $document->isProxyInitialized()))) {
                continue;
            }

            $id                                     = $class->getPHPIdentifierValue($id);
            $groupedIds[$className][serialize($id)] = $id;
        }
    }
1241626
public function setDocumentPersister(string $documentName, Persisters\DocumentPersister $persister) : void
    {
        $this->persisters[$documentName] = $persister;
    }
1095360
function setModelPersist(MongoDB\BSON\Persistable $persistable)
    {
        // reset _query collection
        $this->_q = null;
        
        $this->typeMap['root'] = get_class($persistable);
        $this->persist = $this->typeMap['root'];
        return $this;
    }
705572
static <T> Collection<T> freeze(Collection<T> coll) {
        return coll == null ? null : Collections.unmodifiableCollection(coll);
    }
1019923
public function setOptions(Collection $options)
    {
        /**
         * We want to be able to assign an empty
         * ArrayCollection to variant options.
         *
         * When the collection is not empty, each
         * option in the collection will be added
         * separately since it needs to update the
         * parent product attribute list
         */
        if ($options->isEmpty()) {
            $this->options = $options;
        } else {
            $this->options->clear();
        }

        /**
         * @var ValueInterface $option
         */
        foreach ($options as $option) {

            /**
             * We need to update the parent product attribute collection.
             */
            $this->addOption($option);
        }

        return $this;
    }
208948
public Collection<Object> persist(Collection<Object> objColl) {
    if (null == objColl) {
      throw new IllegalArgumentException("object to save cannot be null");
    }

    objMapper.saveObjCollection(keyspace, objColl);
    return objColl;
  }
246628
public function setPersistent($persistent)
    {
        Argument::i()->test(1, 'bool');

        $this->persistent = 1;

        if($persistent) {
            $this->persistent = 2;
        }

        return $this;
    }