/** * @param EditCategoryRequest $request */ public function execute(EditCategoryRequest $request) { $category = $this->categoryRepository->findById($request->getCategoryId()); $category->compose($request->getName()); $this->categoryRepository->update($category); $this->categoryUpdated(); }
/** * @Given there are such categories: */ public function thereAreSuchCategories(TableNode $table) { foreach ($table as $row) { $name = $row['name']; $parentName = $row['parent']; $parent = $this->getCategoryFromListByName($parentName); $category = new Category($name); $this->categoryRepository->add($category); $parent->addChild($category); $this->categoryRepository->update($parent); } }