[symfony-users] Re: sfForm->save() for an update
For this to work, you'll have to find existing records first and then use it while building the form object. -- $profile = "">Profile')->find($request->getParameter('id')); $this->form = new ProfileForm($profile); $this->form->bind($request->getParameter($this->form->getName())); if ($this->form->isValid()) { $php_profile = $this->form->save(); } -- Thanks Avnish Original Message Subject: [symfony-users] Re: sfForm->save() for an update From: Krishan .G To: symfony-users@googlegroups.com Date: Thursday 03 September 2009 02:31 PM Using both solutions getting following error.. Cannot insert a value for auto-increment primary key [Profile.ID] :( On Mon, Aug 31, 2009 at 6:00 PM, Alexandre SALOMEwrote: 2 solutions : - check the id field is set and be sure it is rendered in form (hidden field : $form->renderHiddenFields()) - Add id to parameters : $this->form->bind(array_merge(array('id' => $id), $request->getParameter($this->form->getName(; Good luck 2009/8/31 krishan Friends I am facing a problem for updating a record in table in many steps. In each step I save the submitted data. This is my code $this->form = new ProfileForm(); $this->form->bind($request->getParameter($this->form->getName())); if ($this->form->isValid()) { $this->form->setOption('id', $request->getParameter('id')); $php_profile = $this->form->save(); } when I run $this->form->save(); function it adds a new record in database. But I want it to update the record provided with the id. Does anyone knows how to do that. I tried o use $this->form->setNew (false); but does not work with $this object... -- Alexandre Salomé -- alexandre.sal...@gmail.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 -~--~~~~--~~--~--~---
[symfony-users] Re: Doctrine_Validator_Exception
Looks like you have a field in your table which is set to "notnull: true" in schema.yml file AND you have either unset this field in the form generated by Symfony or not setting it to any value. Either way, this field is not being populated with any value thus defaults to true per Doctrine which isn't allowed by your schema validation rule (from schema.yml). You can either do "notnull: false" OR keep this value populated with a default value. Hope it helps! Original Message Subject: [symfony-users] Re: Doctrine_Validator_Exception From: warhorse25 To: symfony users Date: Thursday 06 August 2009 12:20 AM > Somebody? Anybody? > > > On Jul 31, 5:44 pm, warhorse25 wrote: >> This error has been eating my lunch all day. Any help on this one >> would be great. Thanks. >> >> On Jul 31, 9:18 am, AeroCosmic wrote: >> >>> I'm getting the following error when trying to create a new entity >>> with the auto-generated form for "sites" >>> Validation failed in class Sites >>> 1 field had validation error: >>> * 1 validator failed on userid (notnull) >>> stack trace >>> * at () >>> in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin >>> \lib\vendor\doctrine\Doctrine\Transaction.php line 265 ... >>> 262. if ($this->_internalNestingLevel >>> == 1) { >>> 263. $tmp = $this->invalid; >>> 264. $this->invalid = array(); >>> 265. throw new >>> Doctrine_Validator_Exception($tmp); >>> 266. } >>> 267. } >>> 268. if ($this->_nestingLevel == 1) { >>> I'm using symfony 1.2 >>> Where does it come from ? >> > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[symfony-users] Re: Running out of memory when creating the cache
Which version of symfony are you using? I was seeing similar error while I was using (symfony 1.2.4) cache with doctrine forms. Then I found following bug http://trac.symfony-project.org/ticket/5814 - which apparently is fixed in 1.2.7 You may want to switch to 1.2.8 and see if it fixes your error!! From your error message itself it's clear that serilized object is using around 8.5M (out of 32MB) memory - needless to say more than 24M has already been consumed by application before execution reached to this point. Original Message Subject: [symfony-users] Running out of memory when creating the cache From: Gervasio To: symfony users Date: Saturday 01 August 2009 12:13 AM > Hi! > > I posted this on the forum, but got no replies. Probably the list is > the place to get more feedback ;) > > We have a decently big app, and we have our max_memory limit on 32 MB, > however this is an issue that happened when we had 128 MB too. > > When I see the error log from apache, I see a lot of > > [Thu Jul 23 09:56:15 2009] [error] [client XXX.XXX.XXX.XXX] PHP Fatal > error: Allowed memory size of 33554432 bytes exhausted (tried to > allocate 8711424 bytes) in /path/to/app/cache/frontend/prod/config/ > config_core_compile. yml.php on line 3365 > > We're also seeing some weird issues that are fixed just by clearing > the cache, so my guess is that some cache files might get corrupted > when this fatal error happens. > > I thought we might run the cache generator each say, 12 hours in a > cron with a higher memory_limit, but then I'd like to disable the > cache generation when the app runs - if the cache is generated, just > use it. Otherwise, just open the yml files as the _dev does. Do you > know how can I: > > 1) Generate the cache in a cron > 2) Disable the cache generation on the app > > This is the function that causes the memory failure. > > public function shutdown() > { > if (!is_null($this->cache) && $this->cacheChanged) > { > $this->cacheChanged = false; > $this->cache->set('symfony.routing.data', serialize($this- >> cacheData)); > } > } > > The line 3365 is > > $this->cache->set('symfony.routing.data', serialize($this- >> cacheData)); > > Thanks in advance! > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[symfony-users] Re: Form field uneditable?
In your form class use following: $this->widgetSchema['field_to_make_uneditable']->setAttribute('readonly','readonly'); It works with inputbox only though Original Message Subject: [symfony-users] Form field uneditable? From: Eno To: symfony-users@googlegroups.com Date: Friday 31 July 2009 10:26 PM > Is there a way to set a form field as uneditable? > > I have a field I want to display in my form but I need to generate it when > I save the form so the user can't change it manually. > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---