/** * @param CreateMaterialRequest $request */ public function execute(CreateMaterialRequest $request) { $category = $request->getCategory(); if (count($category->getChildren())) { $this->callWarningLimitationAssignOnlyToLeaf($category); return; } $material = $this->materialFactory->create($request->getName(), $request->getCode(), $request->getCategory(), $request->getUnit()); $this->materialRepository->add($material); }