public function getProductOptionsByName($articleId, $optionNames) { $query = $this->entityManager->getDBALQueryBuilder(); $query->select(array('options.id', 'options.group_id', 'options.name', 'options.position'))->from('s_article_configurator_options', 'options')->innerJoin('options', 's_article_configurator_option_relations', 'relation', 'relation.option_id = options.id')->innerJoin('relation', 's_articles_details', 'variant', 'variant.id = relation.article_id AND variant.articleID = :article')->groupBy('options.id')->where('options.name IN (:names)')->setParameter('article', $articleId)->setParameter(':names', $optionNames, Connection::PARAM_STR_ARRAY); $statement = $query->execute(); return $statement->fetchAll(\PDO::FETCH_ASSOC); }
/** * @param EventArgs $arguments */ public function preRemoveCategory(EventArgs $arguments) { $categoryModel = $arguments->get('entity'); $categoryId = $categoryModel->getId(); $builder = $this->em->getDBALQueryBuilder(); $builder->delete('s_articles_sort')->where('categoryId = :categoryId')->setParameter('categoryId', $categoryId); $builder->execute(); }
/** * Returns smallest taxId * * @return int */ private function getTaxId() { $builder = $this->em->getDBALQueryBuilder(); $taxId = $builder->select('MIN(id) AS id')->from('s_core_tax', 'tax')->execute()->fetch(); return (int) $taxId['id']; }