views:

260

answers:

1

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.Translation 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!

A: 

You Can't refer to slug field and you never need to.

sumesh
I see I can't, but I DO need to.
David