Why do you create a Form for this instead of just directly using
$c2->save()?

2010/8/27 cosmy <[email protected]>

> Hi all.
> I want to duplicate some inserted categories (retrieved by a query) of
> my model changing some attribute.
> I've written this code in a backend action but it doesn't work
> foreach($categories as $category){
>                        $c2 = new Category();
>                        $c2 = clone $category;
>                        $c2->setCustomer($customer);
>                        $c2->setId_interview('NULL');
>                        $c2->setId(''); //don't want the same id of
> $category!!
>                        $categoryform = new CategoryForm($c2);
>                        $category2 = $categoryform->save();
> }
>
> I receive this error:
>
> 500 | Internal Server Error | sfValidatorErrorSchema
>
> stack trace
>
>    * at ()
>      in SF_ROOT_DIR/lib/form/doctrine/base/BaseCategoryForm.class.php
> line 85 ...
>
>                   $this->widgetSchema->setNameFormat('category[%s]');
>
>                   $this->errorSchema = new
> sfValidatorErrorSchema($this->validatorSchema);
>
>                   $this->setupInheritance();
>
>
> What's wrong with it? the $categories i'm going to duplicate are
> stored in the DB, so they wouldn't contain invalid values
>
> --
> 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 [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=en
>

-- 
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 [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

Reply via email to