Doctrine\ODM\MongoDB\PersistentCollection::getOwner PHP Method

getOwner() public method

INTERNAL: Gets the collection owner.
public getOwner ( ) : object
return object
    public function getOwner()
    {
        return $this->owner;
    }

Usage Example

 /**
  * Gets the parent information for a given PersistentCollection. It will
  * retrieve the top-level persistent Document that the PersistentCollection
  * lives in. We can use this to issue queries when updating a
  * PersistentCollection that is multiple levels deep inside an embedded
  * document.
  *
  *     <code>
  *     list($path, $parent) = $this->getPathAndParent($coll)
  *     </code>
  *
  * @param PersistentCollection $coll
  * @return array $pathAndParent
  */
 private function getPathAndParent(PersistentCollection $coll)
 {
     $mapping = $coll->getMapping();
     $fields = array();
     $parent = $coll->getOwner();
     while (null !== ($association = $this->uow->getParentAssociation($parent))) {
         list($m, $owner, $field) = $association;
         if (isset($m['reference'])) {
             break;
         }
         $parent = $owner;
         $fields[] = $field;
     }
     $propertyPath = implode('.', array_reverse($fields));
     $path = $mapping['name'];
     if ($propertyPath) {
         $path = $propertyPath . '.' . $path;
     }
     return array($path, $parent);
 }
All Usage Examples Of Doctrine\ODM\MongoDB\PersistentCollection::getOwner