jerrylow
jerrylow

Reputation: 2629

symfony drop down with sfguardusers from a specific group

Using sfguard and doctrine I have the following groups:

Managers Chefs Waiters

I have a module for receipts and in the form I want to select a waiter. The default ReceiptForm.class.php populates the fields:

$this->setWidgets(array(
    'id'               => new sfWidgetFormInputHidden(),
    'sf_guard_user_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('sfGuardUser'), 'add_empty' => true)),
);

Its fine as it grabs all the users but how do I configure it to only have users from the group "waiters" or id=3 in the database?

Upvotes: 0

Views: 183

Answers (1)

macgyver
macgyver

Reputation: 1279

You can pass a Doctrine_Query object to the widget with the query option as explained in Chapter 10 - Forms for Propel. It' the same thing using Doctrine.

Upvotes: 1

Related Questions