protected function applyFilter(RestRequestContract $request, QueryBuilder $qb)
    {
        $entity = $this->base()->findById($request->getId());

        $relateCriteria = Criteria::create();
        $relateCriteria->andWhere($relateCriteria->expr()->eq($this->mappedBy(), $entity->getId()));

        $qb->innerJoin($qb->getRootAliases()[0].'.'.$this->mappedBy(), $this->mappedBy());
        $qb->addCriteria($relateCriteria);

        parent::applyFilter($request, $qb);
    }
protected function applyFilter(RestRequestContract $request, QueryBuilder $qb)
    {
        $entity = $this->base()->findById($request->getId());

        $relateCriteria = Criteria::create();
        $relateCriteria->andWhere($relateCriteria->expr()->eq($this->mappedBy(), $entity->getId()));

        $qb->innerJoin($qb->getRootAliases()[0].'.'.$this->mappedBy(), $this->mappedBy());
        $qb->addCriteria($relateCriteria);

        parent::applyFilter($request, $qb);
    }
protected function applyFilter ( RestRequestContract $ request , QueryBuilder $ qb ) { $ entity = $ this -> base ( ) -> findById ( $ request -> getId ( ) ) ; $ relateCriteria = Criteria :: create ( ) ; $ relateCriteria -> andWhere ( $ relateCriteria -> expr ( ) -> eq ( $ this -> mappedBy ( ) , $ entity -> getId ( ) ) ) ; $ qb -> innerJoin ( $ qb -> getRootAliases ( ) [ 0 ] . '.' . $ this -> mappedBy ( ) , $ this -> mappedBy ( ) ) ; $ qb -> addCriteria ( $ relateCriteria ) ; parent :: applyFilter ( $ request , $ qb ) ; }
Add filter by relation entity.

@param RestRequestContract $request
@param QueryBuilder        $qb

@return $this
@throws \Pz\Doctrine\Rest\Exceptions\RestException
Add filter by relation entity .