Example #1
0
 protected function createComponentProduct() : Nette\Application\UI\Multiplier
 {
     return new Nette\Application\UI\Multiplier(function ($id) : Ytnuk\Shop\Product\Control {
         $entity = $this->productRepository->getById($id);
         if ($entity instanceof Ytnuk\Shop\Product\Entity) {
             return $this->productControl->create($entity);
         }
         return NULL;
     });
 }
Example #2
0
 public function setValues($values, $erase = FALSE) : Ytnuk\Orm\Form\Container
 {
     $container = parent::setValues($values, $erase);
     $link = $this->entity->link;
     $link->module = 'Shop:Product';
     if (!$link->parameters->get()->getBy(['key' => $key = current($this->repository->getEntityMetadata()->getPrimaryKey())])) {
         $linkParameter = new Ytnuk\Link\Parameter\Entity();
         $linkParameter->key = $key;
         $linkParameter->value = $this->entity->getPersistedId() ?: $this->repository->persist($this->entity)->getPersistedId();
         $link->parameters->add($linkParameter);
     }
     return $container;
 }
Example #3
0
 public function getterProducts() : Nextras\Orm\Collection\ICollection
 {
     return $this->productRepository->findBy(['this->categoryNodes->category' => $this->id]);
 }
Example #4
0
 public function actionEdit(int $id)
 {
     if (!($this->entity = $this->repository->getById($id))) {
         $this->error();
     }
 }