Yeah, this is not working. I guess that's what I'm saying. I'm taking two new objects, populating them, then saving one and using that ID to populate a column in the other object. For whatever reason, this is not working. BUT, the row is saved to the DB upon $obj->save() OR $this->product->save() or whatever else I try.
I'm not using propel (rather, the original author didn't us it) but this is what the BaseObject class looks like: class BaseProductProfile extends BaseEntityRecord { public function setTableDefinition() { $this->setTableName('product_profile'); $this->hasColumn('id', 'integer', 11, array ('primary'=>true, 'required'=>true, 'autoincrement'=> true)); $this->hasColumn('user_characteristic_id', 'integer', 11, array()); $this->hasColumn('patient_first_name', text, null, array()); $this->hasColumn('patient_last_name', text, null, array()); $this->hasColumn('updated', 'timestamp', null, array()); $this->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); } public function setUp() { $this->hasOne('ProductProfile as Product', array('local' => 'id', 'foreign'=>'id')); } } Here's the schema for the object in question: CREATE TABLE IF NOT EXISTS `product_profile` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_characteristic_id` int(11) NOT NULL, `product_first_name` varchar(128) NOT NULL, `product_last_name` varchar(128) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=127 ; On Oct 6, 2:13 pm, Nick Winfield <pion...@superhaggis.com> wrote: > $this->product->getId() will give you the auto increment ID of the row just > inserted > > 2009/10/6 Josh <joshlaro...@gmail.com> > > > > > Hi all: > > > I'm still pretty fresh to Symfony so bear with my newbie questions and > > confusions. > > > Here's the deal: > > > $this->product = new Product; // from BaseProduct::Product > > > $obj = $this->product->save(); > > > echo $obj->getProductId(); // product.product_id: int(11), > > autoincrement, primary key. > > > The echo yields nothing though the object is saved to a row in the > > table. > > > Thoughts? > > > Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---