src/Backend/Modules/Commerce/Domain/Product/ProductRepository.php
/**
     * Find a product based on the url part.
     *
     * @throws NonUniqueResultException
     * @throws NoResultException
     */
Find a product based on the url part.
Find a product based on the url part .
public function findByLocaleAndUrl(Locale $locale, string $url): Product
    {
        $queryBuilder = $this->createQueryBuilder('i');
        return $queryBuilder->select('i')
            ->join(Meta::class, 'm', 'WITH', 'm.id = i.meta')
            ->where('i.locale = :locale')
            ->andWhere('m.url = :url')
            ->setParameters(
                [
                    'locale' => $locale,
                    'url' => $url,
                ]
            )
            ->getQuery()
            ->getSingleResult();
    }
public function findByLocaleAndUrl ( Locale $ locale , string $ url ) : Product { $ queryBuilder = $ this -> createQueryBuilder ( 'i' ) ; return $ queryBuilder -> select ( 'i' ) -> join ( Meta :: class , 'm' , 'WITH' , 'm.id = i.meta' ) -> where ( 'i.locale = :locale' ) -> andWhere ( 'm.url = :url' ) -> setParameters ( [ 'locale' => $ locale , 'url' => $ url , ] ) -> getQuery ( ) -> getSingleResult ( ) ; }
Find a product based on the url part.
Find a product based on the url part .