Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cesarockstar1985/0a2f7d7a9e70b14aafa0ff2532e2b25a to your computer and use it in GitHub Desktop.
Save cesarockstar1985/0a2f7d7a9e70b14aafa0ff2532e2b25a to your computer and use it in GitHub Desktop.
public function edit($id = null)
{
$couple = $this->Couples->get($id, [
'contain' => [
'Males',
'Females',
'Males.Profiles',
'Females.Profiles',
]
]
);
if ($this->request->is(['patch', 'post', 'put'])) {
$couple = $this->Couples->patchEntity($couple, $this->getRequest()->getData());
if ($this->Couples->save($couple)) {
$this->Flash->success(__('The couple has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The couple could not be saved. Please, try again.'));
}
$profilesTable = $this->fetchTable('profiles');
$user = $this->Authentication->getIdentity();
$ageRange = $profilesTable->getAgeRange();
$religions = $profilesTable->getReligions();
$bibleTranslations = $profilesTable->getBibleTranslations();
$weddingStatuses = $this->Couples->getWeddingStatues();
$countries = Countries::getList();
$this->set(compact('user'));
$this->set(compact('couple'));
$this->set(compact('ageRange'));
$this->set(compact('countries'));
$this->set(compact('religions'));
$this->set(compact('bibleTranslations'));
$this->set(compact('weddingStatuses'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment