Elorfin
Elorfin

Reputation: 2497

Form : sfWidgetFormDoctrineChoice, choose the method

In my form I want to use a widget Doctrine, but I can't change the method use to display the result of the doctrine query.

I have make a function in my model :

public function quartiers() {
  return $this->getQuartier();
}

And in MyClassForm :

$this->widgetSchema['list_quartiers'] = new sfWidgetFormDoctrineChoice(array('model'=>Parclogement',
'add_empty'=>false, 'method' => 'quartiers()', 'query'=> $result = Doctrine_Query::create()->select('p.quartier'->from('Parclogement p'->groupBy('quartier')));

I have this error :

Unknown method Parclogement::quartiers()

When I try my widget with the default method (__toString), It works.

Upvotes: 0

Views: 908

Answers (1)

Milind Ganjoo
Milind Ganjoo

Reputation: 1280

Maybe it's the parentheses after 'quartiers()'? Try making it 'method' => 'quartiers'?

Upvotes: 1

Related Questions