Hi, UPDATE
The same problem happens with edit/update not just new/create. Both objects save but FK becomes 1 whatever it was before. P Anyone? On May 24, 1:47 pm, Tofuwarrior <p...@clearintent.co.uk> wrote: > Hi Tom, > > Thanks for replying. My problem has moved on. > > I can render the forms fine now but when I save in new mode the system > saves the parent(storyteller) and the child (contact_details) objects > but doesn't put the right FK reference in the parent so all of the > parent objects I save have a child_id of 1 even though the child form > is saving and creating a new child object fine. > > The create action is as follows: > public function executeCreate(sfWebRequest $request) > { > $this->forward404Unless($request->isMethod(sfRequest::POST)); > > $this->form = new MscdbStorytellerForm(); > $params= $request->getParameter($this->form->getName()); > $this->forward404Unless($this->MscdbProject = > MscdbProjectPeer::retrieveByPK($params['project_id'])); > > $this->checkOwnership(); > > $this->form->embedForm('contact_details_id',new > MscdbContactDetailsForm()); > > $this->processForm($request, $this->form); > > $this->setTemplate('new'); > } > > processForm is standard. $form->save() if the form isValid. > > doSave etc is all standard.... > protected function doSave($con = null) > { > if (null === $con) > { > $con = $this->getConnection(); > } > > $this->updateObject(); > > $this->getObject()->save($con); > // embedded forms > $this->saveEmbeddedForms($con); > } > > Any ideas? I'm stumped. > > On May 21, 3:26 pm, Tofuwarrior <p...@clearintent.co.uk> wrote: > > > Hi, > > > Anyone give me any pointers? I'm stumped and not really sure where to > > look. Would really appreciate any help anyone could give, deadline is > > looming :-( > > > I have anembeddedform that works fine for the 'new' action but > > when it gets called in edit then it throws an error, I've included the > > stack trace at the bottom of this. > > > I've checked that the object for theformalso has theembeddedobject > > and it is fine, theformrenders fine until it gets the to echo > > $form['embedded'] bit when it throws this error. > > > 500 | Internal Server Error | InvalidArgumentException > > You must pass an array of values to render a widget schema > > stack trace > > > * at () > > in SF_ROOT_DIR/lib/vendor/symfony/lib/widget/ > > sfWidgetFormSchema.class.php line 536 ... > > 533. > > 534. if (!is_array($values) && !$values instanceof > > ArrayAccess) > > 535. { > > 536. throw new InvalidArgumentException('You must > > pass an array of values to render a widget schema'); > > 537. } > > 538. > > 539. $formFormat = $this->getFormFormatter(); > > * at > > sfWidgetFormSchema->render('mscdb_storyteller[contact_details_id]', 1, > > array(), null) > > > in SF_ROOT_DIR/lib/vendor/symfony/lib/widget/ > > sfWidgetFormSchemaDecorator.class.php line 61 ... > > 58. */ > > 59. public function render($name, $values = array(), > > $attributes = array(), $errors = array()) > > 60. { > > 61. return strtr($this->decorator, array('%content%' > > => $this->widget->render($name, $values, $attributes, $errors))); > > 62. } > > 63. > > 64. /** > > * at > > sfWidgetFormSchemaDecorator->render('mscdb_storyteller[contact_details_id]', > > 1, array(), null) > > > in SF_ROOT_DIR/lib/vendor/symfony/lib/widget/ > > sfWidgetFormSchema.class.php line 512 ... > > 509. $clone = clone $widget; > > 510. $clone->setIdFormat($this->options['id_format']); > > > 511. > > 512. return $clone->render($this->generateName($name), > > $value, array_merge($clone->getAttributes(), > > > $attributes), $errors); > > 513. } > > 514. > > 515. /** > > * at sfWidgetFormSchema->renderField('contact_details_id', 1, > > array(), null) > > in SF_ROOT_DIR/lib/vendor/symfony/lib/form/sfFormField.class.php > > line 119 ... > > 116. { > > 117. if ($this->parent) > > 118. { > > 119. return > > $this->parent->getWidget()->renderField($this->name, $this->value, > > $attributes, $this->error); > > > 120. } > > 121. else > > 122. { > > * at sfFormField->render() > > in SF_ROOT_DIR/lib/vendor/symfony/lib/form/sfFormField.class.php > > line 58 ... > > 55. { > > 56. try > > 57. { > > 58. return $this->render(); > > 59. } > > 60. catch (Exception $e) > > 61. { > > * at sfFormField->__toString() > > in SF_ROOT_DIR/apps/frontend/modules/teller/templates/_form.php > > line 59 ... > > 56. <th><?php echo > > $form['contact_details_id']->renderLabel() ?></th> > > > 57. <td> > > 58. <?php //echo > > $form['contact_details_id']->renderError() ?> > > > 59. <?php echo $form['contact_details_id'] ?> > > 60. </td> > > 61. </tr> > > 62. > > * at require('/mnt/Target01/338166/www.mostsignificantchange.com/ > > web/apps/frontend/modules/teller/templates/_form.php') > > in SF_ROOT_DIR/lib/vendor/symfony/lib/view/sfPHPView.class.php > > line 75 ... > > 72. > > 73. try > > 74. { > > 75. require($_sfFile); > > 76. } > > 77. catch (Exception $e) > > 78. { > > * at > > sfPHPView->renderFile('/mnt/Target01/338166/www.mostsignificantchange.com/web/apps/frontend/modules/teller/templa...) > > in SF_ROOT_DIR/lib/vendor/symfony/lib/view/ > > sfPartialView.class.php line 110 ... > > 107. $this->getAttributeHolder()->set('sf_type', > > 'partial'); > > 108. > > 109. // render template > > 110. $retval = > > $this->renderFile($this->getDirectory().'/'.$this->getTemplate()); > > > 111. } > > 112. catch (Exception $e) > > 113. { > > * at sfPartialView->render() > > in SF_ROOT_DIR/lib/vendor/symfony/lib/helper/PartialHelper.php > > line 218 ... > > 215. $view = new $class($context, $moduleName, > > $actionName, ''); > > 216. $view->setPartialVars(true === > > sfConfig::get('sf_escaping_strategy') ? > > sfOutputEscaper::unescape($vars) : $vars); > > 217. > > 218. return $view->render(); > > 219. } > > 220. > > 221. /** > > * at get_partial('form', array('form' => > > object('MscdbStorytellerForm'))) > > in SF_ROOT_DIR/lib/vendor/symfony/lib/helper/PartialHelper.php > > line 180 ... > > 177. */ > > 178. function include_partial($templateName, $vars = > > array()) > > 179. { > > 180. echo get_partial($templateName, $vars); > > 181. } > > 182. > > 183. /** > > * at include_partial('form', array('form' => > > object('MscdbStorytellerForm'))) > > in SF_ROOT_DIR/apps/frontend/modules/teller/templates/ > > editSuccess.php line 3 ... > > 1. <h1>Edit Storyteller</h1> > > 2. > > 3. <?php include_partial('form', array('form' => > > $form)) ?> > > 4. > > * at require('/mnt/Target01/338166/www.mostsignificantchange.com/ > > web/apps/frontend/modules/teller/templates/editSuccess.php') > > in SF_ROOT_DIR/lib/vendor/symfony/lib/view/sfPHPView.class.php > > line 75 ... > > 72. > > 73. try > > 74. { > > 75. require($_sfFile); > > 76. } > > 77. catch (Exception $e) > > 78. { > > * at > > sfPHPView->renderFile('/mnt/Target01/338166/www.mostsignificantchange.com/web/apps/frontend/modules/teller/templa...) > > in SF_ROOT_DIR/lib/vendor/symfony/lib/view/sfPHPView.class.php > > line 185 ... > > 182. $this->attributeHolder->set('sf_type', > > 'action'); > > 183. > > 184. // render template file > > 185. $content = > > $this->renderFile($this->getDirectory().'/'.$this->getTemplate()); > > > 186. > > 187. if (sfConfig::get('sf_cache') && null !== > > $uri) > > 188. { > > * at sfPHPView->render() > > in SF_ROOT_DIR/lib/vendor/symfony/lib/filter/ > > sfExecutionFilter.class.php line 155 ... > > 152. break; > > 153. > > 154. case sfView::RENDER_CLIENT: > > 155. $viewData = $view->render(); > > 156. > > $this->context->getResponse()->setContent($viewData); > > > 157. break; > > 158. > > * at sfExecutionFilter->executeView('teller', 'edit', 'Success', > > array('MscdbProject' => object('MscdbProject'), 'form' => > > object('MscdbStorytellerForm'))) > > in > > ... > > read more » -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com 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