protected function execute(InputInterface $input, OutputInterface $output) { $staff = new Staff(); $staff->setUsername($input->getArgument("username")); $staff->setPassword($input->getArgument("password")); $this->slim_app->em->persist($staff); $this->slim_app->em->flush(); }
public function execute(CommandInterface $command) { if (!$command instanceof CreateStaffCommand) { throw new \DomainException("Internal error, silahkan hubungi CS kami"); } $command->setRepository($this->staff_repository); $violation = $this->validator->validate($command); if ($violation->count() > 0) { $message = $violation->get(0)->getMessage(); throw new \DomainException($message); } $staff = new Staff(); $this->hash_service->setRawPassword($command->getPassword()); $staff->setUsername($command->getUsername()); $staff->setPassword($this->hash_service->hash()); $this->staff_repository->save($staff); return true; }