示例#1
0
文件: Control.php 项目: ytnuk/shop
 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;
     });
 }
示例#2
0
文件: Container.php 项目: ytnuk/shop
 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;
 }
示例#3
0
文件: Entity.php 项目: ytnuk/shop
 public function getterProducts() : Nextras\Orm\Collection\ICollection
 {
     return $this->productRepository->findBy(['this->categoryNodes->category' => $this->id]);
 }
示例#4
0
文件: Presenter.php 项目: ytnuk/shop
 public function actionEdit(int $id)
 {
     if (!($this->entity = $this->repository->getById($id))) {
         $this->error();
     }
 }