protected function getConditions() { $conditions = parent::getConditions(); if (null !== $this->context) { $conditions->add(new Eq('shop', $this->context->getCurrentShopIdentifier())); } return $conditions; }
/** * {@inheritdoc} */ public function getQueryBuilder(ColumnCollection $columns, DataSetRequestInterface $request) : QueryBuilder { $queryBuilder = parent::getQueryBuilder($columns, $request); $expression = $queryBuilder->expr()->eq('cart_product.cart', ':cart'); $queryBuilder->andWhere($expression); $queryBuilder->setParameter('cart', $this->cartContext->getCurrentCartIdentifier()); $queryBuilder->setParameter('date', (new \DateTime())->setTime(0, 0, 1)); return $queryBuilder; }
/** * Adds additional criteria to query builder. Filters dataset by current shop scope * * @param ColumnCollection $columns * @param DataSetRequestInterface $request * * @return \Doctrine\ORM\QueryBuilder */ public function getQueryBuilder(ColumnCollection $columns, DataSetRequestInterface $request) { $queryBuilder = parent::getQueryBuilder($columns, $request); if (null !== $this->context) { $expression = $queryBuilder->expr()->eq('page_shops.id', ':shop'); $queryBuilder->andWhere($expression); $queryBuilder->setParameter('shop', $this->context->getCurrentShopIdentifier()); } return $queryBuilder; }