Ejemplo n.º 1
0
 /**
  * Sets a PersistentCollection instance.
  *
  * This method is intended to be used with the "set" or "setArray"
  * strategies. The "setArray" strategy will ensure that the collection is
  * set as a BSON array, which means the collection elements will be
  * reindexed numerically before storage.
  *
  * @param PersistentCollection $coll
  * @param array $options
  */
 private function setCollection(PersistentCollection $coll, array $options)
 {
     list($propertyPath, $parent) = $this->getPathAndParent($coll);
     $coll->initialize();
     $mapping = $coll->getMapping();
     $setData = $this->pb->prepareAssociatedCollectionValue($coll, CollectionHelper::usesSet($mapping['strategy']));
     $query = array('$set' => array($propertyPath => $setData));
     $this->executeQuery($parent, $query, $options);
 }