hello staff would like to help with a following question I have the tables Pessoa and Pessoa Fisica
pessoa: _attributes: { idMethod: native } id: { type: INTEGER, required: true, autoIncrement: true, primaryKey: true } created_at: { type: TIMESTAMP } updated_at: { type: TIMESTAMP } nome: { type: VARCHAR, size: '40' } pessoa_fisica: _attributes: { idMethod: native } id: { type: INTEGER, required: true, autoIncrement: true, primaryKey: true } created_at: { type: TIMESTAMP } updated_at: { type: TIMESTAMP } pai: { type: VARCHAR, size: '40' } mae: { type: VARCHAR, size: '40' } rg: { type: VARCHAR, size: '10' } cpf: { type: VARCHAR, size: '14' } data_nascimento: { type: TIMESTAMP } tel_ddd1: { type: VARCHAR, size: '2' } tel_num1: { type: VARCHAR, size: '10' } tel_ddd2: { type: VARCHAR, size: '2' } tel_num2: { type: VARCHAR, size: '10' } pessoa_id: { type: INTEGER, required: true, foreignTable: pessoa, foreignReference: id, onDelete: RESTRICT, onUpdate: RESTRICT } _indexes: { FK_pessoa_fisica_0: [pessoa_id]} Both are correct for my type of application and the relationship is working. In my file cadastrarpessoaSuccess.php I have the fields being printed correctly but I'm not printing the pessoa_id why have not registered the person (being a person who is physically to be related to a person). in my action (see right) I would like to have the following code ... public function executeCadastrarpessoa($request) { $this->form = new PessoaForm(); $this->form_pessoa_fisica = new PessoaFisicaForm(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter('pessoa')); $this->form_pessoa_fisica->bind($request- >getParameter('pessoa_fisica')); if ($this->form->isValid() && $this->form_pessoa_fisica- >isValid()) { try { // pessoa $pessoa = $this->form->save(); // pessoa fisica $this->form_pessoa_fisica->getObject()- >setPessoaId($pessoa->getId()); $pessoa_fisica = $this- >form_pessoa_fisica->save(); $this->getUser()->setFlash('sucesso', 'OK. =)'); $this->form = new PessoaForm(); $this->form_pessoa_fisica = new PessoaFisicaForm(); }catch($e) { $this->getUser()->setFlash('erro', 'Error: 65494654454544656 ...'); } } } } Well above this the code that I thought to be able to resolve my this problem under the code that works my problem is that after we made the bind (by which I understand it converts in the array object) After he is done I can not change the value of PessoaId in my object to save the relationship correct. Another thing I would like to know if it is nice to get validation of key because of foreign layout without entering the value of pessoa_id can not pass by function isValid (); public function executeCadastrarpessoa($request) { $this->form = new PessoaForm(); $this->form_pessoa_fisica = new PessoaFisicaForm(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter('pessoa')); $pessoa_fisica = $request->getParameter('pessoa_fisica'); $pessoa_fisica['pessoa_id'] = "1"; $this->form_pessoa_fisica->bind($pessoa_fisica); if ($this->form->isValid() && $this- >form_pessoa_fisica->isValid()) { try { // pessoa $pessoa = $this->form->save(); // pessoa fisica $pessoa_fisica = $request- >getParameter('pessoa_fisica'); $pessoa_fisica['pessoa_id'] = $pessoa- >getId(); $this->form_pessoa_fisica- >bind($pessoa_fisica); $pessoa_fisica = $this- >form_pessoa_fisica->save(); $this->getUser()->setFlash('sucesso', 'OK. =)'); $this->form = new PessoaForm(); $this->form_pessoa_fisica = new PessoaFisicaForm(); }catch($e) { $this->getUser()->setFlash('erro', 'Error: 65494654454544656 ...'); } } } } I appreciate any help. If someone does not understand the problem may request further information. now appreciate that. Excuse my English --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---