/** * * @param Command $command */ private function sendMail(Command $command) { $login = $command->entity()->getLogin(); $transport = new MailTransport('mail'); $mail = new Mail($transport->conf()); $mail->setSubject('Remind password')->setFrom($mail->getAdminEmail())->setTo($this->http->request->get('userEmail'))->setBody("Dear {$login}\n" . "Your new password is: {$this->randomPassword}\n" . "You can change it later in your user account."); $mail->send(); }
private function saveMenuEntityAndSetLastAddedId() { $controller = new Command(new Menus()); $unique = ['unique']; if (!empty($this->request['id'])) { $controller->find($this->request['id']); $unique = []; } $controller->setName($this->request['name'])->setPosition($this->request['position'])->insert(['name' => $unique, 'position' => $unique]); $this->lastId = $controller->entity()->getId(); }
public function run() { $this->request = $this->http->request->all(); // Initialize $controller = new Command(new Posts()); $date = new \DateTime(); // Find entity by id to update if ($this->request['id']) { $controller->find($this->request['id']); $date = $controller->entity()->getDate('DateTime'); } $alias = $controller->getAlias($this->request['title']); $public = (int) $this->request['public'] ?? 0; $controller->setReference('category', $this->getCategoryId())->setReference('author', $this->view->getUserId())->setDate($date)->setTitle($this->request['title'])->setAlias($alias)->setContent($this->request['content'])->setPublic($public)->insert(['date' => [], 'title' => [], 'alias' => [], 'content' => []]); Server::headerLocation($this->url('admin-post-edit', ['action' => 'edit', 'alias' => $alias])); }
/** * * @param Command $command */ private function saveData(Command $command) { $command->setEmail($this->http->request->get('userEmail'))->update(['email' => ['unique' => [$command->entity()->getEmail()]]]); }
public function __construct(Command $command) { $this->command = $command; $this->registry = RegistryFactory::start(); $this->entityName = get_class($this->command->entity()); }