Doctrine\ODM\MongoDB\UnitOfWork::getParentAssociation PHP Method

getParentAssociation() public method

list($mapping, $parent, $propertyPath) = $this->getParentAssociation($embeddedDocument);
public getParentAssociation ( object $document ) : array
$document object
return array $association
    public function getParentAssociation($document)
    {
        $oid = spl_object_hash($document);
        if (!isset($this->parentAssociations[$oid])) {
            return null;
        }
        return $this->parentAssociations[$oid];
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @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;
 }
All Usage Examples Of Doctrine\ODM\MongoDB\UnitOfWork::getParentAssociation
UnitOfWork