• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP MongoDB\UnitOfWork类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Doctrine\ODM\MongoDB\UnitOfWork的典型用法代码示例。如果您正苦于以下问题:PHP UnitOfWork类的具体用法?PHP UnitOfWork怎么用?PHP UnitOfWork使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了UnitOfWork类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1:

 function it_schedules_owning_document_for_update_when_setting_element_by_key_in_the_collection(MongoDBODMUnitOfWork $uow, DocumentStub $document, ObjectRepository $repository, ClassMetadata $classMetadata, EntityStub $entity4, EntityStub $entity8, EntityStub $entity15, EntityStub $newEntity)
 {
     $classMetadata->getIdentifier()->willReturn(['id']);
     $repository->findBy(['id' => [4, 8, 15]])->willReturn([$entity4, $entity8, $entity15]);
     $uow->getDocumentState($document)->willReturn(MongoDBODMUnitOfWork::STATE_MANAGED);
     $uow->isScheduledForUpdate($document)->willReturn(false);
     $uow->scheduleForUpdate($document)->shouldBeCalled();
     $this->setOwner($document);
     $this->set(2, $newEntity);
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:10,代码来源:ReferencedCollectionSpec.php


示例2: process

 /**
  * @param PermissionsAwareInterface[] $documents
  * @param DocumentManager $dm
  * @param UnitOfWork $uow
  * @param bool $insert
  */
 protected function process($documents, DocumentManager $dm, UnitOfWork $uow, $insert = false)
 {
     foreach ($documents as $document) {
         $perms = $document->getPermissions();
         $files = $this->getFiles($document);
         foreach ($files as $file) {
             $filePermissions = $file->getPermissions()->clear()->inherit($perms);
             if ($insert) {
                 $dm->persist($filePermissions);
             }
             $uow->computeChangeSet($dm->getClassMetadata(get_class($file)), $file);
         }
     }
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:20,代码来源:AbstractUpdateFilesPermissionsSubscriber.php


示例3: createDBRef

 /**
  * Returns a DBRef array for the supplied document.
  *
  * @param mixed $document A document object
  * @param array $referenceMapping Mapping for the field that references the document
  *
  * @throws \InvalidArgumentException
  * @return array A DBRef array
  */
 public function createDBRef($document, array $referenceMapping = null)
 {
     if (!is_object($document)) {
         throw new \InvalidArgumentException('Cannot create a DBRef, the document is not an object');
     }
     $class = $this->getClassMetadata(get_class($document));
     $id = $this->unitOfWork->getDocumentIdentifier($document);
     if (!$id) {
         throw new \RuntimeException(sprintf('Cannot create a DBRef without an identifier. UnitOfWork::getDocumentIdentifier() did not return an identifier for class %s', $class->name));
     }
     if (!empty($referenceMapping['simple'])) {
         return $class->getDatabaseIdentifierValue($id);
     }
     $dbRef = array('$ref' => $class->getCollection(), '$id' => $class->getDatabaseIdentifierValue($id));
     if (empty($referenceMapping['partial'])) {
         $dbRef['$db'] = $this->getDocumentDatabase($class->name)->getName();
     }
     /* If the class has a discriminator (field and value), use it. A child
      * class that is not defined in the discriminator map may only have a
      * discriminator field and no value, so default to the full class name.
      */
     if (isset($class->discriminatorField)) {
         $dbRef[$class->discriminatorField] = isset($class->discriminatorValue) ? $class->discriminatorValue : $class->name;
     }
     /* Add a discriminator value if the referenced document is not mapped
      * explicitly to a targetDocument class.
      */
     if ($referenceMapping !== null && !isset($referenceMapping['targetDocument'])) {
         $discriminatorField = $referenceMapping['discriminatorField'];
         $discriminatorValue = isset($referenceMapping['discriminatorMap']) ? array_search($class->name, $referenceMapping['discriminatorMap']) : $class->name;
         /* If the discriminator value was not found in the map, use the full
          * class name. In the future, it may be preferable to throw an
          * exception here (perhaps based on some strictness option).
          *
          * @see PersistenceBuilder::prepareEmbeddedDocumentValue()
          */
         if ($discriminatorValue === false) {
             $discriminatorValue = $class->name;
         }
         $dbRef[$discriminatorField] = $discriminatorValue;
     }
     return $dbRef;
 }
开发者ID:backplane,项目名称:mongodb-odm,代码行数:52,代码来源:DocumentManager.php


示例4: current

 /**
  * @see \Doctrine\MongoDB\EagerCursor::current()
  * @see http://php.net/manual/en/iterator.current.php
  */
 public function current()
 {
     $current = parent::current();
     if ($current === null || !$this->hydrate) {
         return $current;
     }
     return $this->unitOfWork->getOrCreateDocument($this->class->name, $current, $this->unitOfWorkHints);
 }
开发者ID:im286er,项目名称:ent,代码行数:12,代码来源:EagerCursor.php


示例5: prepareReferencedDocValue

    /**
     * Returns the reference representation to be stored in mongodb or null if not applicable.
     *
     * @param array $referenceMapping
     * @param Document $document
     * @return array|null
     */
    public function prepareReferencedDocValue(array $referenceMapping, $document)
    {
        $id = null;
        if (is_array($document)) {
            $className = $referenceMapping['targetDocument'];
        } else {
            $className = get_class($document);
            $id = $this->uow->getDocumentIdentifier($document);
        }
        $class = $this->dm->getClassMetadata($className);
        if (null !== $id) {
            $id = $class->getDatabaseIdentifierValue($id);
        }
        $ref = array(
            $this->cmd . 'ref' => $class->getCollection(),
            $this->cmd . 'id' => $id,
            $this->cmd . 'db' => $class->getDatabase()
        );

        // Store a discriminator value if the referenced document is not mapped explicitely to a targetDocument
        if ( ! isset($referenceMapping['targetDocument'])) {
            $discriminatorField = isset($referenceMapping['discriminatorField']) ? $referenceMapping['discriminatorField'] : '_doctrine_class_name';
            $discriminatorValue = isset($referenceMapping['discriminatorMap']) ? array_search($class->getName(), $referenceMapping['discriminatorMap']) : $class->getName();
            $ref[$discriminatorField] = $discriminatorValue;
        }
        return $ref;
    }
开发者ID:pmjones,项目名称:php-framework-benchmarks,代码行数:34,代码来源:PersistenceBuilder.php


示例6: loadReferenceManyCollection

 private function loadReferenceManyCollection(PersistentCollection $collection)
 {
     $mapping = $collection->getMapping();
     $cmd = $this->cmd;
     $groupedIds = array();
     foreach ($collection->getMongoData() as $reference) {
         $className = $this->dm->getClassNameFromDiscriminatorValue($mapping, $reference);
         $mongoId = $reference[$cmd . 'id'];
         $id = (string) $mongoId;
         $reference = $this->dm->getReference($className, $id);
         $collection->add($reference);
         if ($reference instanceof Proxy && !$reference->__isInitialized__) {
             if (!isset($groupedIds[$className])) {
                 $groupedIds[$className] = array();
             }
             $groupedIds[$className][] = $mongoId;
         }
     }
     foreach ($groupedIds as $className => $ids) {
         $class = $this->dm->getClassMetadata($className);
         $mongoCollection = $this->dm->getDocumentCollection($className);
         $data = $mongoCollection->find(array('_id' => array($cmd . 'in' => $ids)));
         foreach ($data as $documentData) {
             $document = $this->uow->getById((string) $documentData['_id'], $class->rootDocumentName);
             $data = $this->hydratorFactory->hydrate($document, $documentData);
             $this->uow->setOriginalDocumentData($document, $data);
         }
     }
 }
开发者ID:jackbravo,项目名称:symfony-sandbox,代码行数:29,代码来源:DocumentPersister.php


示例7: getAtomicCollectionUpdateQuery

 private function getAtomicCollectionUpdateQuery($document)
 {
     $update = array();
     $collections = $this->uow->getScheduledCollections($document);
     $collPersister = $this->uow->getCollectionPersister();
     foreach ($collections as $coll) {
         /* @var $coll PersistentCollection */
         $mapping = $coll->getMapping();
         if ($mapping['strategy'] !== "atomicSet" && $mapping['strategy'] !== "atomicSetArray") {
             continue;
         }
         if ($this->uow->isCollectionScheduledForUpdate($coll)) {
             $update = array_merge_recursive($update, $collPersister->prepareSetQuery($coll));
             $this->uow->unscheduleCollectionUpdate($coll);
             /* TODO:
              * Collection can be set for both deletion and update if
              * PersistentCollection instance was changed. Since we're dealing
              * with collection update in one query we won't need the $unset.
              * Line can be removed once the issue is fixed.
              */
             $this->uow->unscheduleCollectionDeletion($coll);
         } elseif ($this->uow->isCollectionScheduledForDeletion($coll)) {
             $update = array_merge_recursive($update, $collPersister->prepareDeleteQuery($coll));
             $this->uow->unscheduleCollectionDeletion($coll);
         }
     }
     return $update;
 }
开发者ID:uedehua,项目名称:laravel5-mongodb,代码行数:28,代码来源:DocumentPersister.php


示例8: getIdentifierValue

 /**
  * Returns the value of the identifier field of a document
  *
  * Doctrine must know about this document, that is, the document must already
  * be persisted or added to the identity map before. Otherwise an
  * exception is thrown.
  *
  * @param  object $document  The document for which to get the identifier
  * @throws FormException   If the document does not exist in Doctrine's
  *                         identity map
  */
 public function getIdentifierValue($document)
 {
     if (!$this->unitOfWork->isInIdentityMap($document)) {
         throw new FormException('documents passed to the choice field must be managed');
     }
     return $this->unitOfWork->getDocumentIdentifier($document);
 }
开发者ID:3116246,项目名称:haolinju,代码行数:18,代码来源:DocumentChoiceList.php


示例9: loadCollection

    public function loadCollection(PersistentCollection $collection)
    {
        $mapping = $collection->getMapping();
        $cmd = $this->dm->getConfiguration()->getMongoCmd();
        $groupedIds = array();
        foreach ($collection->getReferences() as $reference) {
            $className = $this->dm->getClassNameFromDiscriminatorValue($mapping, $reference);
            $id = $reference[$cmd . 'id'];
            $reference = $this->dm->getReference($className, (string) $id);
            $collection->add($reference);
            if ($reference instanceof Proxy && ! $reference->__isInitialized__) {
                if ( ! isset($groupedIds[$className])) {
                    $groupedIds[$className] = array();
                }
                $groupedIds[$className][] = $id;
            }
        }

        foreach ($groupedIds as $className => $ids) {
            $mongoCollection = $this->dm->getDocumentCollection($className);
            $data = $mongoCollection->find(array('_id' => array($cmd . 'in' => $ids)));
            $hints = array(Builder::HINT_REFRESH => true);
            foreach ($data as $id => $documentData) {
                $document = $this->uow->getOrCreateDocument($className, $documentData, $hints);
            }
        }
    }
开发者ID:pmjones,项目名称:php-framework-benchmarks,代码行数:27,代码来源:DocumentPersister.php


示例10: hydrateDocument

 /**
  * @param array $document
  * @return array|object|null
  */
 private function hydrateDocument($document)
 {
     if ($document !== null && $this->class !== null) {
         return $this->unitOfWork->getOrCreateDocument($this->class->name, $document);
     }
     return $document;
 }
开发者ID:doctrine,项目名称:mongodb-odm,代码行数:11,代码来源:CommandCursor.php


示例11: createReferenceManyInverseSideQuery

 /**
  * @param PersistentCollection $collection
  *
  * @return Query
  */
 public function createReferenceManyInverseSideQuery(PersistentCollection $collection)
 {
     $hints = $collection->getHints();
     $mapping = $collection->getMapping();
     $owner = $collection->getOwner();
     $ownerClass = $this->dm->getClassMetadata(get_class($owner));
     $targetClass = $this->dm->getClassMetadata($mapping['targetDocument']);
     $mappedByMapping = isset($targetClass->fieldMappings[$mapping['mappedBy']]) ? $targetClass->fieldMappings[$mapping['mappedBy']] : array();
     $mappedByFieldName = isset($mappedByMapping['simple']) && $mappedByMapping['simple'] ? $mapping['mappedBy'] : $mapping['mappedBy'] . '.$id';
     $criteria = $this->cm->merge(array($mappedByFieldName => $ownerClass->getIdentifierObject($owner)), $this->dm->getFilterCollection()->getFilterCriteria($targetClass), isset($mapping['criteria']) ? $mapping['criteria'] : array());
     $criteria = $this->uow->getDocumentPersister($mapping['targetDocument'])->prepareQueryOrNewObj($criteria);
     $qb = $this->dm->createQueryBuilder($mapping['targetDocument'])->setQueryArray($criteria);
     if (isset($mapping['sort'])) {
         $qb->sort($mapping['sort']);
     }
     if (isset($mapping['limit'])) {
         $qb->limit($mapping['limit']);
     }
     if (isset($mapping['skip'])) {
         $qb->skip($mapping['skip']);
     }
     if (!empty($hints[Query::HINT_SLAVE_OKAY])) {
         $qb->slaveOkay(true);
     }
     if (!empty($hints[Query::HINT_READ_PREFERENCE])) {
         $qb->setReadPreference($hints[Query::HINT_READ_PREFERENCE], $hints[Query::HINT_READ_PREFERENCE_TAGS]);
     }
     return $qb->getQuery();
 }
开发者ID:im286er,项目名称:ent,代码行数:34,代码来源:DocumentPersister.php


示例12: getQueryForDocument

 /**
  * Get shard key aware query for single document.
  *
  * @param object $document
  *
  * @return array
  */
 private function getQueryForDocument($document)
 {
     $id = $this->uow->getDocumentIdentifier($document);
     $id = $this->class->getDatabaseIdentifierValue($id);
     $shardKeyQueryPart = $this->getShardKeyQuery($document);
     $query = array_merge(array('_id' => $id), $shardKeyQueryPart);
     return $query;
 }
开发者ID:dominium,项目名称:mongodb-odm,代码行数:15,代码来源:DocumentPersister.php


示例13: loadReferenceManyCollectionOwningSide

 private function loadReferenceManyCollectionOwningSide(PersistentCollection $collection)
 {
     $hints = $collection->getHints();
     $mapping = $collection->getMapping();
     $cmd = $this->cmd;
     $groupedIds = array();
     foreach ($collection->getMongoData() as $key => $reference) {
         if (isset($mapping['simple']) && $mapping['simple']) {
             $className = $mapping['targetDocument'];
             $mongoId = $reference;
         } else {
             $className = $this->dm->getClassNameFromDiscriminatorValue($mapping, $reference);
             $mongoId = $reference[$cmd . 'id'];
         }
         $id = (string) $mongoId;
         if (!$id) {
             continue;
         }
         $reference = $this->dm->getReference($className, $id);
         if ($mapping['strategy'] === 'set') {
             $collection->set($key, $reference);
         } else {
             $collection->add($reference);
         }
         if ($reference instanceof Proxy && !$reference->__isInitialized__) {
             if (!isset($groupedIds[$className])) {
                 $groupedIds[$className] = array();
             }
             $groupedIds[$className][] = $mongoId;
         }
     }
     foreach ($groupedIds as $className => $ids) {
         $class = $this->dm->getClassMetadata($className);
         $mongoCollection = $this->dm->getDocumentCollection($className);
         $criteria = array_merge(array('_id' => array($cmd . 'in' => $ids)), $this->dm->getFilterCollection()->getFilterCriteria($class), isset($mapping['criteria']) ? $mapping['criteria'] : array());
         $cursor = $mongoCollection->find($criteria);
         if (isset($mapping['sort'])) {
             $cursor->sort($mapping['sort']);
         }
         if (isset($mapping['limit'])) {
             $cursor->limit($mapping['limit']);
         }
         if (isset($mapping['skip'])) {
             $cursor->skip($mapping['skip']);
         }
         if (isset($hints[Query::HINT_SLAVE_OKAY])) {
             $cursor->slaveOkay(true);
         }
         $documents = $cursor->toArray();
         foreach ($documents as $documentData) {
             $document = $this->uow->getById((string) $documentData['_id'], $class->rootDocumentName);
             $data = $this->hydratorFactory->hydrate($document, $documentData);
             $this->uow->setOriginalDocumentData($document, $data);
             $document->__isInitialized__ = true;
         }
     }
 }
开发者ID:3116246,项目名称:haolinju,代码行数:57,代码来源:DocumentPersister.php


示例14: doSet

 /**
  * Actual logic for setting an element in the collection.
  *
  * @param mixed $offset
  * @param mixed $value
  * @param bool $arrayAccess
  * @return bool
  */
 private function doSet($offset, $value, $arrayAccess)
 {
     $arrayAccess ? $this->coll->offsetSet($offset, $value) : $this->coll->set($offset, $value);
     // Handle orphanRemoval
     if ($this->uow !== null && $this->isOrphanRemovalEnabled() && $value !== null) {
         $this->uow->unscheduleOrphanRemoval($value);
     }
     $this->changed();
 }
开发者ID:alcaeus,项目名称:mongodb-odm,代码行数:17,代码来源:PersistentCollectionTrait.php


示例15: _prepareDocReference

 /**
  * Returns the reference representation to be stored in mongodb or null if not applicable.
  *
  * @param ClassMetadata $class
  * @param Document $doc
  * @return array|null
  */
 private function _prepareDocReference(ClassMetadata $class, $doc)
 {
     if (!is_object($doc)) {
         return $doc;
     }
     $id = $this->_uow->getDocumentIdentifier($doc);
     if (null !== $id) {
         $id = $class->getPHPIdentifierValue($id);
     }
     $ref = array($this->_cmd . 'ref' => $class->getCollection(), $this->_cmd . 'id' => $id, $this->_cmd . 'db' => $class->getDB());
     return $ref;
 }
开发者ID:klaasn,项目名称:symfony-sandbox,代码行数:19,代码来源:BasicDocumentPersister.php


示例16: isPartOfAtomicUpdate

 /**
  * @param object $embeddeDoc
  * @return bool
  */
 private function isPartOfAtomicUpdate($embeddeDoc)
 {
     $isInDirtyCollection = false;
     while (null !== ($parentAssoc = $this->uow->getParentAssociation($embeddeDoc))) {
         list($mapping, $embeddeDoc, ) = $parentAssoc;
         if ($mapping['association'] === ClassMetadata::EMBED_MANY) {
             $classMetadata = $this->dm->getClassMetadata(get_class($embeddeDoc));
             $parentColl = $classMetadata->getFieldValue($embeddeDoc, $mapping['fieldName']);
             $isInDirtyCollection |= $parentColl->isDirty();
         }
     }
     return isset($mapping['association']) && $mapping['association'] === ClassMetadata::EMBED_MANY && ($mapping['strategy'] === 'atomicSet' || $mapping['strategy'] === 'atomicSetArray') && $isInDirtyCollection;
 }
开发者ID:noc-med,项目名称:mongodb-odm,代码行数:17,代码来源:PersistenceBuilder.php


示例17: prepareReferencedDocValue

 /**
  * Returns the reference representation to be stored in mongodb or null if not applicable.
  *
  * @param array $referenceMapping
  * @param Document $document
  * @return array|null
  */
 private function prepareReferencedDocValue(array $referenceMapping, $document)
 {
     $class = $this->dm->getClassMetadata(get_class($document));
     $id = $this->uow->getDocumentIdentifier($document);
     if (null !== $id) {
         $id = $class->getDatabaseIdentifierValue($id);
     }
     $ref = array($this->cmd . 'ref' => $class->getCollection(), $this->cmd . 'id' => $id, $this->cmd . 'db' => $class->getDB());
     if (!isset($referenceMapping['targetDocument'])) {
         $discriminatorField = isset($referenceMapping['discriminatorField']) ? $referenceMapping['discriminatorField'] : '_doctrine_class_name';
         $discriminatorValue = isset($referenceMapping['discriminatorMap']) ? array_search($class->getName(), $referenceMapping['discriminatorMap']) : $class->getName();
         $ref[$discriminatorField] = $discriminatorValue;
     }
     return $ref;
 }
开发者ID:roydonstharayil,项目名称:sugarbox,代码行数:22,代码来源:BasicDocumentPersister.php


示例18: prepareAssociatedCollectionValue

 /**
  * Returns the collection representation to be stored and unschedules it afterwards.
  *
  * @param PersistentCollection $coll
  * @param bool $includeNestedCollections
  * @return array
  */
 public function prepareAssociatedCollectionValue(PersistentCollection $coll, $includeNestedCollections = false)
 {
     $mapping = $coll->getMapping();
     $pb = $this;
     $callback = isset($mapping['embedded']) ? function ($v) use($pb, $mapping, $includeNestedCollections) {
         return $pb->prepareEmbeddedDocumentValue($mapping, $v, $includeNestedCollections);
     } : function ($v) use($pb, $mapping) {
         return $pb->prepareReferencedDocumentValue($mapping, $v);
     };
     $setData = $coll->map($callback)->toArray();
     if (CollectionHelper::isList($mapping['strategy'])) {
         $setData = array_values($setData);
     }
     $this->uow->unscheduleCollectionDeletion($coll);
     $this->uow->unscheduleCollectionUpdate($coll);
     return $setData;
 }
开发者ID:WillSkates,项目名称:mongodb-odm,代码行数:24,代码来源:PersistenceBuilder.php


示例19: createDBRef

 /**
  * Returns a DBRef array for the supplied document.
  *
  * @param mixed $document A document object
  * @param array $referenceMapping Mapping for the field that references the document
  *
  * @throws \InvalidArgumentException
  * @return array A DBRef array
  */
 public function createDBRef($document, array $referenceMapping = null)
 {
     if (!is_object($document)) {
         throw new \InvalidArgumentException('Cannot create a DBRef, the document is not an object');
     }
     $class = $this->getClassMetadata(get_class($document));
     $id = $this->unitOfWork->getDocumentIdentifier($document);
     if (!$id) {
         throw new \RuntimeException(sprintf('Cannot create a DBRef for class %s without an identifier. Have you forgotten to persist/merge the document first?', $class->name));
     }
     if ($referenceMapping['storeAs'] === ClassMetadataInfo::REFERENCE_STORE_AS_ID) {
         if ($class->inheritanceType === ClassMetadataInfo::INHERITANCE_TYPE_SINGLE_COLLECTION) {
             throw MappingException::simpleReferenceMustNotTargetDiscriminatedDocument($referenceMapping['targetDocument']);
         }
         return $class->getDatabaseIdentifierValue($id);
     }
     $dbRef = array('$ref' => $class->getCollection(), '$id' => $class->getDatabaseIdentifierValue($id));
     if ($referenceMapping['storeAs'] === ClassMetadataInfo::REFERENCE_STORE_AS_DB_REF_WITH_DB) {
         $dbRef['$db'] = $this->getDocumentDatabase($class->name)->getName();
     }
     /* If the class has a discriminator (field and value), use it. A child
      * class that is not defined in the discriminator map may only have a
      * discriminator field and no value, so default to the full class name.
      */
     if (isset($class->discriminatorField)) {
         $dbRef[$class->discriminatorField] = isset($class->discriminatorValue) ? $class->discriminatorValue : $class->name;
     }
     /* Add a discriminator value if the referenced document is not mapped
      * explicitly to a targetDocument class.
      */
     if ($referenceMapping !== null && !isset($referenceMapping['targetDocument'])) {
         $discriminatorField = $referenceMapping['discriminatorField'];
         $discriminatorValue = isset($referenceMapping['discriminatorMap']) ? array_search($class->name, $referenceMapping['discriminatorMap']) : $class->name;
         /* If the discriminator value was not found in the map, use the full
          * class name. In the future, it may be preferable to throw an
          * exception here (perhaps based on some strictness option).
          *
          * @see PersistenceBuilder::prepareEmbeddedDocumentValue()
          */
         if ($discriminatorValue === false) {
             $discriminatorValue = $class->name;
         }
         $dbRef[$discriminatorField] = $discriminatorValue;
     }
     return $dbRef;
 }
开发者ID:dominium,项目名称:mongodb-odm,代码行数:55,代码来源:DocumentManager.php


示例20: clear

 /**
  * {@inheritdoc}
  */
 public function clear()
 {
     if ($this->initialized && $this->isEmpty()) {
         return;
     }
     if ($this->isOrphanRemovalEnabled()) {
         foreach ($this->coll as $element) {
             $this->uow->scheduleOrphanRemoval($element);
         }
     }
     $this->mongoData = array();
     $this->coll->clear();
     if ($this->mapping['isOwningSide']) {
         $this->changed();
         $this->uow->scheduleCollectionDeletion($this);
         $this->takeSnapshot();
     }
 }
开发者ID:uedehua,项目名称:laravel5-mongodb,代码行数:21,代码来源:PersistentCollection.php



注:本文中的Doctrine\ODM\MongoDB\UnitOfWork类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Event\LifecycleEventArgs类代码示例发布时间:2022-05-23
下一篇:
PHP MongoDB\MongoDBException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap