コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function process($group)
 {
     $this->form->setData($group);
     if ($this->request->isMethod('POST')) {
         // TODO : how to fix this ? Load products when ODM storage is used to enable validation
         if (null === $group->getProducts()) {
             $products = $this->productRepository->findAllForGroup($group)->toArray();
             $group->setProducts($products);
         }
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             $this->onSuccess($group);
             return true;
         } elseif ($group->getType()->isVariant() && $group->getId()) {
             $products = $this->productRepository->findAllForVariantGroup($group);
             $group->setProducts($products);
         }
     }
     return false;
 }