At first I want to say that I'm only guessing what might be wrong,
because I'm not much experienced Symfony user...so If someone else
know whats wrong, just write it ;)

I would try to simplier the code of the widget...
 'category'    => new sfWidgetFormDoctrineChoice(array('model' =>
'Category', 'method' => 'getName', 'add_empty' => '')),

Then you can try to remove the validator for the widget ... is it
working without he validator?



On 24 bře, 08:59, HiDDeN <davidmoralesmoj...@gmail.com> wrote:
> Like this:
>
> $query_categories = 
> Doctrine_Core::getTable('Category')->createQuery('c')->select('c.id, t.name 
> name, t.slug slug')-
> >leftJoin('c.Translation t')->andWhere('t.lang = ?', 'en');
>
> 'category'    => new sfWidgetFormDoctrineChoice(array('model' =>
> 'Category', 'method' => 'getName', 'key_method' => 'getSlug', 'query'
> => $query_categories, 'add_empty' => '')),
>
> On Mar 24, 8:13 am, Tom Ptacnik <to...@tomor.cz> wrote:
>
>
>
> > How does the DoctrineChoice widget for this validator look?
>
> > On 22 bře, 15:16, HiDDeN <davidmoralesmoj...@gmail.com> wrote:
>
> > > Yes, it is defined as a i18n table:
>
> > > Category:
> > >   actAs:
> > >     I18n:
> > >       fields: [name]
> > >       actAs:
> > >         Sluggable: { fields: [name], uniqueBy: [lang, name] }
> > >   columns:
> > >     id:      { type: integer(2), unsigned: true, primary: true }
> > >     name: { type: string, length: 50, notnull: true }
>
> > > On Mar 22, 2:53 pm, Tom Ptacnik <to...@tomor.cz> wrote:
>
> > > > Have the model Category a slug attribute?, or better, has it a
> > > > getSlug() method?
>
> > > > On 22 bře, 12:19, HiDDeN <davidmoralesmoj...@gmail.com> wrote:
>
> > > > > I'm using Symfony 1.4.3 + Doctrine 1.2, and a typical i18n category
> > > > > table (the ids are in category, and the name and slug in
> > > > > category_translation).
>
> > > > > I have this Doctrine validator defined in my form:
>
> > > > > $this->setValidators(array(
> > > > >       'category' => new sfValidatorDoctrineChoice(array('model' =>
> > > > > 'Category', 'column' => 'slug')),
> > > > > ));
>
> > > > > So, when I submit the form, I get this error:
>
> > > > > Unknown column slug
>
> > > > > Then I thought: "ok, maybe I should include a query with the
> > > > > Translation table linked, let's do it":
>
> > > > > $query = 
> > > > > Doctrine_Core::getTable('Category')->createQuery('c')->leftJoin('c.Translat
> > > > >  ion t');
>
> > > > > $this->setValidators(array(
> > > > >       'category' => new sfValidatorDoctrineChoice(array('model' =>
> > > > > 'Category', 'query' => $query, 'column' => 'slug')),
> > > > > ));
>
> > > > > And when resubmiting, I'm again getting the same error:
>
> > > > > Unknown column slug
>
> > > > > Mmm... ok, maybe I should define a select statement with the slug
> > > > > field defined. So, I redefine my query like this:
>
> > > > > $query = 
> > > > > Doctrine_Core::getTable('Category')->createQuery('c')->select('c.id, 
> > > > > t.name name, t.slug slug')->leftJoin('c.Translation
>
> > > > > t');
>
> > > > > And again the error:
>
> > > > > Unknown column slug
>
> > > > > I have no more ideas... what should I do??
>
> > > > > Thanks!

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

To unsubscribe from this group, send email to 
symfony-users+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to