/** * @param CreateUnitRequest $request */ public function execute(CreateUnitRequest $request) { $unit = $this->unitFactory->create($request->getName(), $request->getShortcut()); $this->unitRepository->add($unit); $this->unitCreated($unit); }
/** * @Given there are such units: */ public function thereAreSuchUnits(TableNode $table) { foreach ($table as $row) { $this->unitRepository->add(new Unit($row['name'], $row['shortcut'])); } }