public function findByPath($path)
    {
        $qb = $this->createQueryBuilder('r');

        $query = $qb
            ->andWhere($qb->expr()->eq('r.fromPath', ':path'))
            ->andWhere($qb->expr()->eq('r.enabled', ':enabled'))
            ->getQuery()
            ->setMaxResults(1)
            // TODO cache
        ;

        return $query
            ->setParameters([
                'path' => $path,
                'enabled' => true,
            ])
            ->getOneOrNullResult()
        ;
    }
public function findByPath($path)
    {
        $qb = $this->createQueryBuilder('r');

        $query = $qb
            ->andWhere($qb->expr()->eq('r.fromPath', ':path'))
            ->andWhere($qb->expr()->eq('r.enabled', ':enabled'))
            ->getQuery()
            ->setMaxResults(1)
            // TODO cache
        ;

        return $query
            ->setParameters([
                'path' => $path,
                'enabled' => true,
            ])
            ->getOneOrNullResult()
        ;
    }
public function findByPath ( $ path ) { $ qb = $ this -> createQueryBuilder ( 'r' ) ; $ query = $ qb -> andWhere ( $ qb -> expr ( ) -> eq ( 'r.fromPath' , ':path' ) ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'r.enabled' , ':enabled' ) ) -> getQuery ( ) -> setMaxResults ( 1 ) // TODO cache ; return $ query -> setParameters ( [ 'path' => $ path , 'enabled' => true , ] ) -> getOneOrNullResult ( ) ; }
Finds the redirection by "from path".

@param string $path
@return Redirection|null
Finds the redirection by from path .