Пример #1
0
 public function add()
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $contact = new ContactEntity();
         $contact->setName($_POST['name']);
         $contact->setEmail($_POST['email']);
         $contact->setPhone($_POST['phone']);
         $contact->setMessage($_POST['message']);
         $contact->setDate($_POST['date']);
         $contacts_collection = new ContactCollection();
         $contacts_collection->save($contact);
         header('Location: index.php?frontcontroller=contacts');
     }
     $this->loadView('website/contacts');
 }
 public function setPostData(ContactEntity $entity, $post)
 {
     $entity->setName($post->get('name'));
     $entity->setEmail($post->get('email'));
     $entity->setMessage($post->get('message'));
 }