If every Boarder
is a User
, the Boarder
table should include a user_id
field.
The add.ctp
form can look like
<?php
echo $this->Form->create('Boarder', array('role' => 'form', 'novalidate' => true));
echo $this->Form->input('User.username');
echo $this->Form->input('Boarder.home_address');
echo $this->Form->submit();
echo $this->Form->end();
?>
The add
function from the controller is:
public function add()
{
if ($this->request->is('post')) {
debug($this->request->data);
if ($this->Boarder->saveAssociated($this->request->data)) {
// saved
} else {
// not saved
}
}
}