I’ve to create a “register” form, this form has to store information in two different database, some fields goes on the local database(login info: username, password)(model named “User”) , some in the external database (erp database, which contains email, phone, …)(Model named “Customer”).
We have to do this because of the existing ERP, that we have to use(we have no way to edit this, this is our constraint).
So my question is, how to set a register form which allows us to specify the user and the customer information.
This is not a problem to make the insertion of the “customer” in the “user” controller, I just don’t know how to receive a
$this->data
which contains
$this->data['User']
and
$this->data['Customer']
data.
Because in the view, we have to specify which model is used on the “Form” level.
echo $this->Form->create('**User**',array('action'=>'register'));
Thank you very much!
if you wanna have records like $this->data[‘User’] and $this->data[‘Customer’] in your $this->data
your fields of form should be something like this
you have to create realtion between those tables
in model User you have to add this
and you have to use $this->User->saveAll($this->data) to save data in both tables
sorry for my english, and hope it helps you