Try some debugging, like : var_dump($workExperience->toArray());exit;
Be sure of the data you retrieved : is it OK ? Do you have objects, as expected ? A Doctrine_Collection ? Add some assertions to your code to be sure everything happen as hoped. At first look, seems the data you retrieved is not OK. Good luck, Alexandre 2009/11/23 [email protected] <[email protected]> > I'm new with symfony and I'm having some problems with embeding > forms. > I have the following scenario with a Curriculum Vitae and asociated > Work_Experiences: > schema-yml using doctrine: > > BolsadetrabajoCv: > tableName: bolsadetrabajo_cv > actAs: { Timestampable: ~ } > columns: > id: { type: integer(4), primary: true, autoincrement: true} > first_name: string(50) > surname: string(50) > address: string(50) > location: string(255) > city: string(50) > telephone: string(50) > fax: string(50) > token: { type: string(255), notnull: true } > nationality: string(50) > country: { type: string(50), default: Spain} > email: { type: string(255), notnull: true } > date_of_birth: {type: date(25), default: '2000-01-01', notnull: > true } > gender: { type: integer(1), default: '0', notnull: true} > > BolsadetrabajoWorkExperience: > tableName: bolsadetrabajo_work_experience > actAs: { Timestampable: ~ } > columns: > id: { type: integer(3), primary: true, autoincrement: true } > cv_id: { type: integer(4), notnull: true} > date_from: { type: date(25), notnull: true } > date_to: { type: date(25), notnull: false } > occupation: { type: string(255), notnull: true } > main_activities: { type: string(), notnull: true } > address_employer: { type: string(255), notnull: true } > name_employer: string(255) > type_business: string(255) > relations: > BolsadetrabajoCv: { onDelete: CASCADE, local: cv_id, foreign: id, > foreignAlias: BolsadetrabajoWork } > -------------------------------------------- > > So if I try to embed a new form for the Work Experience on the > BolsadetrabajoCvForm.class.php (form for Curriculum) I have no > problem. I picked code from others that embed new forms of > WorkExperience... > My problems come when I try to embed forms with existing data of > WorkExperience into the parent. I followed some very userfull post > like : > http://redotheoffice.com/?p=42&cpage=1#comment-924 > This didn't work for me, I currently have the following code on > BolsadetrabajoCvForm > > $experiencias = $this->getObject()->getActiveWork(); > $i = 1; > foreach ($experiencias as $workform) > { > $this->embedForm('workexperience'.$i, new WorkExperienceForm > ($workform)); > $i++; > } > ------------------------------- > getActiveWork() is defined in BolsadetrabajoCv.class.php as: > > > public function getActiveWork() > { > $q = $this->getActiveWorksQuery(); > return Doctrine::getTable('BolsadetrabajoWorkExperience')- > >getActiveWorks($q); > } > ---------------------- > > So every try I have made changing the BolsadetrabajoCvForm following > several tutorials or webpages renders me the error: > The "WorkExperienceForm" form only accepts a "WorkExperience" object > > ------- > > Could anybody give me a hand in this?? I've spent days looking on > internet and trying different solutions but nothting has worked. > Thanks > > -- > > You received this message because you are subscribed to the Google Groups > "symfony users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<symfony-users%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=. > > > -- Alexandre Salomé -- [email protected] -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected]. 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.
