예제 #1
0
 /**
  *
  * @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();
 }
예제 #2
0
 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();
 }
예제 #3
0
 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]));
 }
예제 #4
0
 /**
  *
  * @param Command $command
  */
 private function saveData(Command $command)
 {
     $command->setEmail($this->http->request->get('userEmail'))->update(['email' => ['unique' => [$command->entity()->getEmail()]]]);
 }
예제 #5
0
파일: Validator.php 프로젝트: ignaszak/cms
 public function __construct(Command $command)
 {
     $this->command = $command;
     $this->registry = RegistryFactory::start();
     $this->entityName = get_class($this->command->entity());
 }