Re: [symfony-users] get id from new row

2010-01-08 Thread Gabo
Thansk to all!! The solution is copy the parent::save() before take the id, example: parent::save(); //Insertamos en la tabla de traza de documentos $sfUser = sfContext::getInstance(); $q = new document_trace(); $q-set('id_document',$this-getId());

Re: [symfony-users] get id from new row

2010-01-07 Thread Gabo
HELP!!! I TRY THIS: //lib/model/doctrine/document.class.php public function save(Doctrine_Connection $conn = null) { $author= new document(); $author-setName($this-getName()); $author-setDocumentDescription($this-getDocumentDescription()); $author-save(); $sfUser =

Fwd: [symfony-users] get id from new row

2010-01-07 Thread Gabo
HELP!!! I TRY THIS: //lib/model/doctrine/document.class.php public function save(Doctrine_Connection $conn = null) { $author= new document(); $author-setName($this-getName()); $author-setDocumentDescription($this-getDocumentDescription()); $author-save(); $sfUser =

Re: [symfony-users] get id from new row

2010-01-07 Thread Stéphane
$q-set('id_document', $author-getId()); - does it work ? if you get error message, please copy/past them. Cheers, Before Printing, Think about Your Environmental Responsibility! Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale! On Fri, Jan 8, 2010 at 1:02 AM, Gabo

Re: [symfony-users] get id from new row

2010-01-07 Thread Lee Bolding
On 8 Jan 2010, at 00:02, Gabo wrote: HELP!!! I TRY THIS: //lib/model/doctrine/document.class.php public function save(Doctrine_Connection $conn = null) { $author= new document(); $author-setName($this-getName());

Re: [symfony-users] get id from new row

2010-01-07 Thread Lee Bolding
On 8 Jan 2010, at 00:19, Lee Bolding wrote: On 8 Jan 2010, at 00:02, Gabo wrote: $q = new document_trace(); $q-set('id_document', $author); //NOT WORK, ERROR Should be $q-set('id_document', $author-getId()); I want to

Re: [symfony-users] get id from new row

2010-01-07 Thread Gabo
ERROR 500 | Internal Server Error | Doctrine_Validator_Exception Validation failed in class document_trace 1 field had validation error: * 1 validator failed on id_document (notnull) is a new record ($ this- getId ()), so it is empty. 2010/1/7 Stéphane stephane.er...@gmail.com

Re: [symfony-users] get id from new row

2010-01-07 Thread Alexandru-Emil Lupu
Pastebin your form. Obviously you do it wrong... I don't have an example atm. Alecs sent via htc magic On Jan 8, 2010 2:55 AM, Gabo gabopo...@gmail.com wrote: ERROR 500 | Internal Server Error | Doctrine_Validator_Exception Validation failed in class document_trace 1 field had validation

[symfony-users] get id from new row

2010-01-06 Thread Gabo
HELP!! I try to capture the id of a new record for storage in an external table (document_trace) but not what brings me /lib/model/doctrine/template.class.php public function save(Doctrine_Connection $conn = null) { if ($this-isNew()) { $sfUser =sfContext::getInstance();

Re: [symfony-users] get id from new row

2010-01-06 Thread Daniel Lohse
You are trying to get the inserted id in the if block: if ($this-isNew()) ??? Well, you are wrinting it, the object is not yet saved! Call parent::save($conn) and then you can get the id from the object. Cheers, Daniel On Jan 6, 2010, at 11:48 PM, Gabo wrote: HELP!! I try to capture

Re: [symfony-users] get id from new row

2010-01-06 Thread Augusto Flavio
Hi Gabo, i was working with embedforms and i need do this for my forms works well. You need save the record that you want get the ID and after save the record that needs the FK. Look this: $author = new author(); ... (set values for author object) $author-save(); //now you save the book

Re: [symfony-users] get id from new row

2010-01-06 Thread Eno
On Wed, 6 Jan 2010, Gabo wrote: HELP!! I try to capture the id of a new record for storage in an external table (document_trace) but not what brings me The ID comes from the database but you haven't saved the object so it has no ID yet. -- -- You received this message because you are