what about:

unset(
     .....
     $this['id']
 );


2010/2/18 Daniel Lohse <annismcken...@googlemail.com>

> Maybe yu forgot to do "echo $form->renderHiddenFields();" in your form so
> the ID that's already assigned to the object is not transmitted when
> submitting the form?
>
> Daniel
>
> On 18.02.2010, at 16:57, Samuel Morhaim wrote:
>
> > <?php
> >
> > /**
> > * Campaign Entry Form.
> > */
> >
> > class CampaignForm extends BaseCampaignForm
> > {
> >  public function configure()
> >  {
> >    unset(
> >      $this['organization_id'],
> >      $this['is_active']
> >      );
> >
> >
> >  }
> > }
> >
> >
> >
> > On Thu, Feb 18, 2010 at 10:42 AM, Gábor Fási <maerl...@gmail.com> wrote:
> >> This looks fine. Can we see your form's configure() method?
> >>
> >> On Thu, Feb 18, 2010 at 16:08, Samuel Morhaim <samuel.morh...@gmail.com>
> wrote:
> >>> Here goes the extra info. :)
> >>>
> >>> 1. I am just doing a simple edit.  (based almost on the generated CRUD
> actions)
> >>> 2. Yes, it is unique, (schema below).
> >>> 3. I am NOT trying to update/modify the ID since it is unique, etc.
> >>> THAT IS the problem.. for some reason it trying to set the ID to
> >>> empty. OR should not be updating the ID at all, but it is doing it....
> >>>
> >>>
> >>>
> >>>
> >>> Actions:
> >>>
> >>>  public function executeEdit(sfWebRequest $request)
> >>>  {
> >>>    $this->forward404Unless($campaign =
> >>>
> Doctrine::getTable('Campaign')->find(array($request->getParameter('id'))),
> >>> sprintf('Object campaign does not exist (%s).',
> >>> $request->getParameter('id')));
> >>>    $this->form = new CampaignForm($campaign);
> >>>  }
> >>>
> >>>  public function executeUpdate(sfWebRequest $request)
> >>>  {
> >>>    $this->forward404Unless($request->isMethod(sfRequest::POST) ||
> >>> $request->isMethod(sfRequest::PUT));
> >>>    $this->forward404Unless($campaign =
> >>>
> Doctrine::getTable('Campaign')->find(array($request->getParameter('id'))),
> >>> sprintf('Object campaign does not exist (%s).',
> >>> $request->getParameter('id')));
> >>>    $this->form = new CampaignForm($campaign);
> >>>
> >>>    $this->processForm($request, $this->form);
> >>>
> >>>    $this->campaigns =
> >>>
> Doctrine::getTable('Campaign')->getCampaigns($this->getUser()->getGuardUser()->Organization);
> >>>    $this->setLayout(AJAX_ENABLED);
> >>>    return $this->renderPartial('campaign/list', array('campaigns' =>
> >>> $this->campaigns));
> >>>  }
> >>>
> >>>  protected function processForm(sfWebRequest $request, sfForm $form)
> >>>  {
> >>>    $form->bind($request->getParameter($form->getName()),
> >>> $request->getFiles($form->getName()));
> >>>    if ($form->isValid())
> >>>    {
> >>>      $campaign = $form->save();
> >>>
> >>>    }
> >>>  }
> >>>
> >>>
> >>>
> >>> ======================
> >>>
> >>>
> >>> SCHEMA
> >>>
> >>> Campaign:
> >>>  columns:
> >>>    id:
> >>>      primary: true
> >>>      unique: true
> >>>      type: integer
> >>>      notnull: true
> >>>      autoincrement: true
> >>>    organization_id:
> >>>      type: integer
> >>>      notnull: true
> >>>    name:
> >>>      unique: false
> >>>      type: string(255)
> >>>      notnull: true
> >>>    description:
> >>>      type: blob(0)
> >>>    is_active:
> >>>      default: true
> >>>      type: boolean
> >>>      notnull: true
> >>>  indexes:
> >>>    IX_Campaign_1:
> >>>      fields: [id]
> >>>    IX_Campaign_2:
> >>>      fields: [is_active]
> >>>  relations:
> >>>    Organization:
> >>>      local: organization_id
> >>>      foreign: id
> >>>
> >>>
> >>>
> >>> =======
> >>>
> >>>
> >>>
> >>> 2010/2/18 Michał Piotrowski <mkkp...@gmail.com>:
> >>>> I'm wondering why do you want to update id? I assume that you are
> >>>> using id as primary key, so updating it to other value just doesn't
> >>>> makes sense.
> >>>>
> >>>> Maybe someone will help you if you explain what do you want to do.
> >>>> Actually we don't have enough information on such things as:
> >>>> - what do you want to do
> >>>> - what you are doing - iow - show us the code - maybe others are, but
> >>>> I'm not a seer :)
> >>>>
> >>>> Regards,
> >>>> Michal
> >>>>
> >>>> 2010/2/18 Samuel Morhaim <samuel.morh...@gmail.com>:
> >>>>> Anyone?
> >>>>>
> >>>>> On 2/17/10, Samuel Morhaim <samuel.morh...@gmail.com> wrote:
> >>>>>> If it helps.. this is the error, of course because it lost the id..
> >>>>>>
> >>>>>> SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate
> entry
> >>>>>> '0' for key 1
> >>>>>> stack trace
> >>>>>>
> >>>>>>     * at ()
> >>>>>>       in
> >>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php
> >>>>>> line 1082 ...
> >>>>>>             1079.             $message .= sprintf('. Failing Query:
> >>>>>> "%s"', $query);
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> On Wed, Feb 17, 2010 at 5:20 PM, Samuel Morhaim
> >>>>>> <samuel.morh...@gmail.com> wrote:
> >>>>>>> I am getting an error when doing a simple edit/update ... the ID of
> >>>>>>> the item is being lost.
> >>>>>>>
> >>>>>>> This is the DB log... maybe somebody can help ?
> >>>>>>>
> >>>>>>>
> >>>>>>> #
> >>>>>>>
> >>>>>>> SELECT c.id AS c__id, c.organization_id AS c__organization_id,
> c.name
> >>>>>>> AS c__name, c.description AS c__description, c.is_active AS
> >>>>>>> c__is_active FROM campaign c WHERE (c.id = '2') LIMIT 1
> >>>>>>> 0.00s, "doctrine" connection Toggle debug stack
> >>>>>>> #23 » in sfDoctrineConnectionProfiler->preStmtExecute() from
> >>>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/EventListener/Chain.php
> >>>>>>> line 494
> >>>>>>> #22 » in Doctrine_EventListener_Chain->preStmtExecute() from
> >>>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/Statement.php
> >>>>>>> line 231
> >>>>>>> #21 » in Doctrine_Connection_Statement->execute() from
> >>>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php
> >>>>>>> line 1006
> >>>>>>> #20 » in Doctrine_Connection->execute() from
> >>>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Query/Abstract.php
> >>>>>>> line 976
> >>>>>>> #19 » in Doctrine_Query_Abstract->_execute() from
> >>>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Query/Abstract.php
> >>>>>>> line 1026
> >>>>>>> #18 » in Doctrine_Query_Abstract->execute() from
> >>>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Query.php
> >>>>>>> line 281
> >>>>>>> #17 » in Doctrine_Query->fetchOne() from
> >>>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Table.php
> >>>>>>> line 1611
> >>>>>>> #16 » in Doctrine_Table->find() from
> >>>>>>> SF_ROOT_DIR/apps/backend/modules/campaign/actions/actions.class.php
> >>>>>>> line 53
> >>>>>>> #15 » in campaignActions->executeUpdate() from
> >>>>>>> SF_SYMFONY_LIB_DIR/action/sfActions.class.php line 60
> >>>>>>> #14 » in sfActions->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfExecutionFilter.class.php line 92
> >>>>>>> #13 » in sfExecutionFilter->executeAction() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfExecutionFilter.class.php line 78
> >>>>>>> #12 » in sfExecutionFilter->handleAction() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfExecutionFilter.class.php line 42
> >>>>>>> #11 » in sfExecutionFilter->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 53
> >>>>>>> #10 » in sfFilterChain->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfBasicSecurityFilter.class.php line 72
> >>>>>>> #9 » in sfBasicSecurityFilter->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 53
> >>>>>>> #8 » in sfFilterChain->execute() from
> >>>>>>>
> SF_ROOT_DIR/plugins/sfDoctrineGuardPlugin/lib/sfGuardRememberMeFilter.class.php
> >>>>>>> line 56
> >>>>>>> #7 » in sfGuardRememberMeFilter->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 53
> >>>>>>> #6 » in sfFilterChain->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfRenderingFilter.class.php line 33
> >>>>>>> #5 » in sfRenderingFilter->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 53
> >>>>>>> #4 » in sfFilterChain->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/controller/sfController.class.php line 229
> >>>>>>> #3 » in sfController->forward() from
> >>>>>>> SF_SYMFONY_LIB_DIR/controller/sfFrontWebController.class.php line
> 48
> >>>>>>> #2 » in sfFrontWebController->dispatch() from
> >>>>>>> SF_SYMFONY_LIB_DIR/util/sfContext.class.php line 170
> >>>>>>> #1 » in sfContext->dispatch() from SF_ROOT_DIR/web/backend_dev.php
> line
> >>>>>>> 13
> >>>>>>> #
> >>>>>>>
> >>>>>>> SELECT c.id AS c__id, c.organization_id AS c__organization_id,
> c.name
> >>>>>>> AS c__name, c.description AS c__description, c.is_active AS
> >>>>>>> c__is_active FROM campaign c WHERE (c.id = '')
> >>>>>>> 0.00s, "doctrine" connection Toggle debug stack
> >>>>>>> #31 » in sfDoctrineConnectionProfiler->preStmtExecute() from
> >>>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/EventListener/Chain.php
> >>>>>>> line 494
> >>>>>>> #30 » in Doctrine_EventListener_Chain->preStmtExecute() from
> >>>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/Statement.php
> >>>>>>> line 231
> >>>>>>> #29 » in Doctrine_Connection_Statement->execute() from
> >>>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php
> >>>>>>> line 1006
> >>>>>>> #28 » in Doctrine_Connection->execute() from
> >>>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Query/Abstract.php
> >>>>>>> line 976
> >>>>>>> #27 » in Doctrine_Query_Abstract->_execute() from
> >>>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Query/Abstract.php
> >>>>>>> line 1026
> >>>>>>> #26 » in Doctrine_Query_Abstract->execute() from
> >>>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Query.php
> >>>>>>> line 281
> >>>>>>> #25 » in Doctrine_Query->fetchOne() from
> >>>>>>>
> SF_SYMFONY_LIB_DIR/plugins/sfDoctrinePlugin/lib/validator/sfValidatorDoctrineUnique.class.php
> >>>>>>> line 99
> >>>>>>> #24 » in sfValidatorDoctrineUnique->doClean() from
> >>>>>>> SF_SYMFONY_LIB_DIR/validator/sfValidatorSchema.class.php line 90
> >>>>>>> #23 » in sfValidatorSchema->clean() from
> >>>>>>> SF_SYMFONY_LIB_DIR/validator/sfValidatorSchema.class.php line 246
> >>>>>>> #22 » in sfValidatorSchema->postClean() from
> >>>>>>> SF_SYMFONY_LIB_DIR/validator/sfValidatorSchema.class.php line 186
> >>>>>>> #21 » in sfValidatorSchema->doClean() from
> >>>>>>> SF_SYMFONY_LIB_DIR/validator/sfValidatorSchema.class.php line 90
> >>>>>>> #20 » in sfValidatorSchema->clean() from
> >>>>>>> SF_SYMFONY_LIB_DIR/form/sfForm.class.php line 247
> >>>>>>> #19 » in sfForm->doBind() from
> >>>>>>> SF_SYMFONY_LIB_DIR/form/addon/sfFormSymfony.class.php line 75
> >>>>>>> #18 » in sfFormSymfony->doBind() from
> >>>>>>> SF_SYMFONY_LIB_DIR/form/sfForm.class.php line 227
> >>>>>>> #17 » in sfForm->bind() from
> >>>>>>> SF_ROOT_DIR/apps/backend/modules/campaign/actions/actions.class.php
> >>>>>>> line 77
> >>>>>>> #16 » in campaignActions->processForm() from
> >>>>>>> SF_ROOT_DIR/apps/backend/modules/campaign/actions/actions.class.php
> >>>>>>> line 56
> >>>>>>> #15 » in campaignActions->executeUpdate() from
> >>>>>>> SF_SYMFONY_LIB_DIR/action/sfActions.class.php line 60
> >>>>>>> #14 » in sfActions->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfExecutionFilter.class.php line 92
> >>>>>>> #13 » in sfExecutionFilter->executeAction() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfExecutionFilter.class.php line 78
> >>>>>>> #12 » in sfExecutionFilter->handleAction() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfExecutionFilter.class.php line 42
> >>>>>>> #11 » in sfExecutionFilter->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 53
> >>>>>>> #10 » in sfFilterChain->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfBasicSecurityFilter.class.php line 72
> >>>>>>> #9 » in sfBasicSecurityFilter->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 53
> >>>>>>> #8 » in sfFilterChain->execute() from
> >>>>>>>
> SF_ROOT_DIR/plugins/sfDoctrineGuardPlugin/lib/sfGuardRememberMeFilter.class.php
> >>>>>>> line 56
> >>>>>>> #7 » in sfGuardRememberMeFilter->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 53
> >>>>>>> #6 » in sfFilterChain->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfRenderingFilter.class.php line 33
> >>>>>>> #5 » in sfRenderingFilter->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/filter/sfFilterChain.class.php line 53
> >>>>>>> #4 » in sfFilterChain->execute() from
> >>>>>>> SF_SYMFONY_LIB_DIR/controller/sfController.class.php line 229
> >>>>>>> #3 » in sfController->forward() from
> >>>>>>> SF_SYMFONY_LIB_DIR/controller/sfFrontWebController.class.php line
> 48
> >>>>>>> #2 » in sfFrontWebController->dispatch() from
> >>>>>>> SF_SYMFONY_LIB_DIR/util/sfContext.class.php line 170
> >>>>>>> #1 » in sfContext->dispatch() from SF_ROOT_DIR/web/backend_dev.php
> line
> >>>>>>> 13
> >>>>>>> #
> >>>>>>>
> >>>>>>> UPDATE campaign SET name = 'TER', id = '' WHERE id = '2'
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>> --
> >>>>> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> >>>>> To post to this group, send email to symfony-us...@googlegroups.com.
> >>>>> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> .
> >>>>> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
> >>>>>
> >>>>>
> >>>>
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> >>> To post to this group, send email to symfony-us...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> .
> >>> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
> >>>
> >>>
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> >> To post to this group, send email to symfony-us...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> .
> >> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
> >>
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "symfony users" group.
> > To post to this group, send email to symfony-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> .
> > For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "symfony users" group.
> To post to this group, send email to symfony-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
>
>


-- 
Germana Oliveira

germanaoliveirab arroba gmail punto com
http://626f67.wordpress.com
http://slcarabobo.wordpress.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-us...@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.

Reply via email to