Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 828703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:45:57+00:00 2026-05-15T03:45:57+00:00

I have a UserForm class which has a select list populated from a related

  • 0

I have a UserForm class which has a select list populated from a related model (specified by a foreign relationship in the yml) like so:

$this->setWidget('report_id', new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Report'))));

I’d like to filter the Report objects that come from this relation by one of the Report fields, “active” such that only Reports with active=1 appear in the form.

I have a method, ReportTable::GetActiveReports() that performs the appropriate query and returns the filtered reports. So one option is to populate the Widget with the results of that function. Any tips on the syntax to do that?

It seems to me the cleaner way is to use the UserFormFilter class to filter the reports by active=1 there. Unfortunately I couldn’t find any documentation on how to use form filters (or really what they are), so maybe this is not the right solution. Is a Form Filter the appropriate tool for this job?
It seems I should use the Doctrine_Record_Filter_Standard class as defined here: http://www.doctrine-project.org/api/orm/1.2/doctrine/doctrine_record_filter_standard.html
But it’s not clear to me the appropriate usage.

Any guidance would be helpful. Thanks!
Dan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:45:58+00:00Added an answer on May 15, 2026 at 3:45 am

    Quickest way to do it would be keeping with the existing code you have but just tweaking it slightly.

    In your model, implement a method that just returns the query object for the required records, but without execute()‘ing it. Basically the query object you’re creating in your GetActiveReports() method (you can then refactor this method to use the new method).

    Then, in your form class:

    $queryObject = Doctrine::getTable("Report")->GetActiveReportsQuery();
    $this->setWidget('report_id',
      new sfWidgetFormDoctrineChoice(array(
        'model' => $this->getRelatedModelName('Report'),
        'query' => $queryObject)
      )
    );
    

    The widget should then use the specified query object to retrieve the right filtered records.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a Userform that lets the user pick a worksheet from a
have written this little class, which generates a UUID every time an object of
I have View Model with inner ViewModel Address propery. public class CommonViewModel{ public AddressViewModel
I have created one user_form class that extends zend form, it has 4 elements
I have written one function in User Mapper class userExist($username) which return true if
I have a User class which may or may not have an associated Department.
I have a Modelform: class POwner4NewModel(ModelForm): class Meta: model = ProductOwner exclude = (o_owner,o_owner_desc,o_product_model,o_main_image,o_thumbnail,o_gallery_images,o_timestamp,o_status)
I have the following code: class UserForm(ModelForm): email = forms.EmailField(widget = forms.TextInput(attrs ={ 'id':'email'}),
I have a userform with 6 list objects. All of the list objects have
How does the Model work? I have a Registry Class like this: public class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.