public function referencesGet( $entityOrContainer, $reference, $source = null )
    {

        if( !( $entityOrContainer instanceof Base || $entityOrContainer instanceof Container ) ) {
            throw new \InvalidArgumentException("You can only lookup references by Entity or Container");
        }

        if( !$this->hasReference( $reference, $detail ) ) {
            throw new EntityReferenceException( $this, $reference );;
        }

        $foreignRepo = $this->entityManager->getRepository( $detail[0] );

        $filterComponent = $this->getFindFilterFactory($source)
            ->get( $detail[1], null, $entityOrContainer );

        // find one / find all
        if( $entityOrContainer instanceof Container ) {
            $findQty = FindFilterComponentFactory::FIND_ALL;
        } else {
            $findQty = $detail[2] ? FindFilterComponentFactory::FIND_ALL : FindFilterComponentFactory::FIND_ONE;
        }

        return $foreignRepo->findByFilterComponents(
            $findQty,
            array( $detail[1] => $filterComponent ),
            $source
        );

    }
public function referencesGet( $entityOrContainer, $reference, $source = null )
    {

        if( !( $entityOrContainer instanceof Base || $entityOrContainer instanceof Container ) ) {
            throw new \InvalidArgumentException("You can only lookup references by Entity or Container");
        }

        if( !$this->hasReference( $reference, $detail ) ) {
            throw new EntityReferenceException( $this, $reference );;
        }

        $foreignRepo = $this->entityManager->getRepository( $detail[0] );

        $filterComponent = $this->getFindFilterFactory($source)
            ->get( $detail[1], null, $entityOrContainer );

        // find one / find all
        if( $entityOrContainer instanceof Container ) {
            $findQty = FindFilterComponentFactory::FIND_ALL;
        } else {
            $findQty = $detail[2] ? FindFilterComponentFactory::FIND_ALL : FindFilterComponentFactory::FIND_ONE;
        }

        return $foreignRepo->findByFilterComponents(
            $findQty,
            array( $detail[1] => $filterComponent ),
            $source
        );

    }
public function referencesGet ( $ entityOrContainer , $ reference , $ source = null ) { if ( ! ( $ entityOrContainer instanceof Base || $ entityOrContainer instanceof Container ) ) { throw new \ InvalidArgumentException ( "You can only lookup references by Entity or Container" ) ; } if ( ! $ this -> hasReference ( $ reference , $ detail ) ) { throw new EntityReferenceException ( $ this , $ reference ) ; ; } $ foreignRepo = $ this -> entityManager -> getRepository ( $ detail [ 0 ] ) ; $ filterComponent = $ this -> getFindFilterFactory ( $ source ) -> get ( $ detail [ 1 ] , null , $ entityOrContainer ) ; // find one / find all if ( $ entityOrContainer instanceof Container ) { $ findQty = FindFilterComponentFactory :: FIND_ALL ; } else { $ findQty = $ detail [ 2 ] ? FindFilterComponentFactory :: FIND_ALL : FindFilterComponentFactory :: FIND_ONE ; } return $ foreignRepo -> findByFilterComponents ( $ findQty , array ( $ detail [ 1 ] => $ filterComponent ) , $ source ) ; }
Get all references

@param Base|Container $entityOrContainer - Starting Entity.
@param mixed $foreignEntity - The type of target Entity we want to retrieve.
@param int $source - The source of the links, either PERSISTED, UNPERSISTED, CHANGED or ALL.

@return Entity|Container|null - whatever is apropriate for the link type.
Get all references