Created
June 15, 2023 16:04
-
-
Save cesarockstar1985/0a2f7d7a9e70b14aafa0ff2532e2b25a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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