Exemplo n.º 1
0
 public function getProductIdsFromChannel(ChannelInterface $channel)
 {
     $productClassName = $this->productRepository->getClassName();
     // Gets the taxon ids
     $queryBuilder = $this->entityManager->createQueryBuilder();
     $queryBuilder->select('product.id')->from($productClassName, 'product')->leftJoin('product.channels', 'channel')->where('channel.id = :channel')->setParameter('channel', $channel->getId());
     $filteredIds = [];
     foreach ($queryBuilder->getQuery()->getArrayResult() as $product) {
         $filteredIds[$productClassName][] = $product['id'];
     }
     return $filteredIds;
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('product_code', 'sylius_product_from_identifier', ['label' => 'sylius.form.promotion_action.add_product_configuration.product', 'class' => $this->productRepository->getClassName(), 'constraints' => [new NotBlank(), new Type(['type' => 'string'])], 'identifier' => 'code']);
 }