public function getQueryPathAndParent(PersistentCollectionInterface $coll, QueryBuilder $qb = null)
    {
        $collMapping = $coll->getMapping();
        $parent      = $coll->getOwner();
        $paths[]     = [$collMapping->name, null];

        while (($association = $this->uow->getParentAssociation($parent)) !== null) {
            list($mapping, $owner, $propertyName, $propertyKey) = $association;

            if ($mapping->reference) {
                break;
            }

            $parent  = $owner;
            $paths[] = [$propertyName, $propertyKey];
        }

        if ($qb === null) {
            $qb = $this->dm->createQueryBuilder(get_class($parent));
        }

        /** @var RootPath|null $path */
        $path = null;
        foreach (array_reverse($paths) as $pathValue) {
            list($pathName, $pathKey) = $pathValue;

            $path = $path === null ? $qb->attr($pathName) : $path->map($pathName);

            switch (gettype($pathKey)) {
                case 'string':
                    $path = $path->map($pathKey);
                    break;
                case 'integer':
                    $path = $path->i($pathKey);
                    break;
            }
        }

        return [$qb, $path, $parent];
    }
public function getQueryPathAndParent(PersistentCollectionInterface $coll, QueryBuilder $qb = null)
    {
        $collMapping = $coll->getMapping();
        $parent      = $coll->getOwner();
        $paths[]     = [$collMapping->name, null];

        while (($association = $this->uow->getParentAssociation($parent)) !== null) {
            list($mapping, $owner, $propertyName, $propertyKey) = $association;

            if ($mapping->reference) {
                break;
            }

            $parent  = $owner;
            $paths[] = [$propertyName, $propertyKey];
        }

        if ($qb === null) {
            $qb = $this->dm->createQueryBuilder(get_class($parent));
        }

        /** @var RootPath|null $path */
        $path = null;
        foreach (array_reverse($paths) as $pathValue) {
            list($pathName, $pathKey) = $pathValue;

            $path = $path === null ? $qb->attr($pathName) : $path->map($pathName);

            switch (gettype($pathKey)) {
                case 'string':
                    $path = $path->map($pathKey);
                    break;
                case 'integer':
                    $path = $path->i($pathKey);
                    break;
            }
        }

        return [$qb, $path, $parent];
    }
public function getQueryPathAndParent ( PersistentCollectionInterface $ coll , QueryBuilder $ qb = null ) { $ collMapping = $ coll -> getMapping ( ) ; $ parent = $ coll -> getOwner ( ) ; $ paths [ ] = [ $ collMapping -> name , null ] ; while ( ( $ association = $ this -> uow -> getParentAssociation ( $ parent ) ) !== null ) { list ( $ mapping , $ owner , $ propertyName , $ propertyKey ) = $ association ; if ( $ mapping -> reference ) { break ; } $ parent = $ owner ; $ paths [ ] = [ $ propertyName , $ propertyKey ] ; } if ( $ qb === null ) { $ qb = $ this -> dm -> createQueryBuilder ( get_class ( $ parent ) ) ; } /** @var RootPath|null $path */ $ path = null ; foreach ( array_reverse ( $ paths ) as $ pathValue ) { list ( $ pathName , $ pathKey ) = $ pathValue ; $ path = $ path === null ? $ qb -> attr ( $ pathName ) : $ path -> map ( $ pathName ) ; switch ( gettype ( $ pathKey ) ) { case 'string' : $ path = $ path -> map ( $ pathKey ) ; break ; case 'integer' : $ path = $ path -> i ( $ pathKey ) ; break ; } } return [ $ qb , $ path , $ parent ] ; }
Create and return a QueryBuilder and Path instance representing the provided
collection's document path, along with the top-level document.

@param PersistentCollectionInterface $coll
@param QueryBuilder|null             $qb

@return mixed[] list($qb, $path, $parent)
Create and return a QueryBuilder and Path instance representing the provided collection s document path along with the top - level document .