public function add(Request $request) { $priorityRepository = new PriorityRepository(); $productCategoryRepository = new ProductCategoryRepository(); $productRepository = new ProductRepository(); return view('bugs.add', ['priorities' => $priorityRepository->fetchAll(), 'productCategories' => $productCategoryRepository->fetchAllActive(), 'products' => $productRepository->fetchAllActive()]); }
public function renderAddProduct() { // $category = new Category('Pizzy'); // má id 1 /** @var Category $pizzaCategory */ $pizzaCategory = $this->entityManager->getReference(Category::class, 1); $product = new Product('Pizza ' . rand(1, 100), $pizzaCategory); $this->productRepository->save($product); dump($product); die; }