Thank you again for replying. I have tried this but I get an error on the page:
Fatal error: cannot use object of type sfFormField as array On Jul 24, 11:08 am, Gareth McCumskey <gmccums...@gmail.com> wrote: > <tr> > <td> > echo $form['field_name']->renderLabel(); > </td> > <td> > echo $form['field_name']; > </td> > > ;) > > ----- Original Message ----- > From: "-gary-" <gary.dun...@gmail.com> > To: "symfony users" <symfony-users@googlegroups.com> > Sent: Friday, July 24, 2009 5:02:45 PM GMT +02:00 Harare / Pretoria > Subject: [symfony-users] Re: Embedding forms / Objects > > If I, in the template: > > <? foreach $form as $status ): ?> > <?php echo $status ?> > <? endforeach; ?> > > I get the whole form and fields. I just need to get these row by row. > Is this possible? > > On Jul 24, 8:35 am, -gary- <gary.dun...@gmail.com> wrote: > > Also, I tried: > > > $this->status_objects = StatusPeer::doSelect(new Criteria()); > > > and var_dump'd and got the form and data as expected. > > > The only problem is that I get this error at the bottom of the page: > > Fatal error: Cannot use object of type sfFormField as array in ... > > > in the template. > > > On Jul 24, 5:11 am, -gary- <gary.dun...@gmail.com> wrote: > > > > Thank you for the reply Gareth. > > > > I am using Propel. > > > When I: > > > foreach( StatusPeer::doSelect(new Criteria()) as $status_object ) > > > is that incorrect? > > > > I var_dubped all over the placec and everything seems to have what is > > > expected. > > > > One this I noticed is that $key is 'status_1', 'status_2',... in > > > StatusEditForm's getStatusObject. Could this be a problem? > > > > On Jul 24, 12:58 am, Gareth McCumskey <gmccums...@gmail.com> wrote: > > > > > What is $this->status_objects? How is it defined? Do you use Propel or > > > > Doctrine to get data from your database? > > > > > If Doctrine then I don't know, but if Propel and you had at some point > > > > perhaps: > > > > > $this->status_objects = StatusObjectsClass::doSelect(new Criteria()); > > > > > Then $this->status_objects would be an array as you defined above but > > > > remember $key needs to be an integer as Propel will store the result > > > > objects > > > > in a numeric indexed array. > > > > > Therefore make sure that the key that is passed or the actual creation > > > > of > > > > $this->status_objects (possibly using a var_dump($this->status_objects) > > > > call > > > > on it) was successful. It might get you one step closer to > > > > troubleshooting > > > > > On Fri, Jul 24, 2009 at 3:10 AM, -gary- <gary.dun...@gmail.com> wrote: > > > > > > Yes, my: > > > > > > public function getStatusObject($key) > > > > > { > > > > > return (isset($this->status_objects[$key])) ? $this- > > > > > >status_objects [$key] : null; > > > > > } > > > > > > is not returning an object and that why I'm having problems in the > > > > > template. > > > > > > Anyone have any idea on this please? > > > > > I'd appreciate any help at all. > > > > > > Thank you for reading. > > > > > -- > > > > Gareth McCumskeyhttp://garethmccumskey.blogspot.com > > > > twitter: @garethmcc --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---