getActiveQueryBuilder example

return $builder->getQuery();
    }

    /** * @param int $id * * @return DetachedShop|null */
    public function getActiveById($id)
    {
        $builder = $this->getActiveQueryBuilder();
        $builder->andWhere('shop.id=:shopId');
        $builder->setParameter('shopId', $id);
        $shop = $builder->getQuery()->getOneOrNullResult();

        if ($shop !== null) {
            $shop = $this->fixActive($shop);
        }

        return $shop;
    }

    
/** * Returns the \Doctrine\ORM\Query to select all active category by parent * * @param int $parentId * @param int|null $customerGroupId * * @return Query<Category> */
    public function getActiveByParentIdQuery($parentId$customerGroupId = null)
    {
        $builder = $this->getActiveQueryBuilder($customerGroupId)
            ->andWhere('c.parentId = :parentId')
            ->setParameter('parentId', $parentId);

        return $builder->getQuery();
    }

    /** * Returns the \Doctrine\ORM\Query to select all assigned categories by the articleId * * @param int $articleId * @param int|null $parentId * * @return Query<Category> */
Home | Imprint | This part of the site doesn't use cookies.