コード例 #1
0
 public function edit($contactId)
 {
     $contact = $this->contactStore->getById($contactId);
     $this->setTitle('Edit Contact', 'Contacts');
     if ($this->request->getMethod() == 'POST') {
         $contact->setValues($this->getParams());
         $contact = $this->contactStore->save($contact);
         $data = ['model' => $contact, 'content_id' => $contact->getId(), 'content' => $contact->getFirstName() . ' ' . $contact->getLastName() . ' ' . $contact->getCompany()];
         Event::trigger('ContentPublished', $data);
         $this->redirect('/contact/edit/' . $contact->getId());
     }
     $form = $this->contactForm();
     $form->setValues($contact->getDataArray());
     $this->view->form = $form;
 }