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

  • SEARCH
  • Home
  • 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 7660553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:28:55+00:00 2026-05-31T13:28:55+00:00

$repository = $this->getDoctrine()->getRepository(‘ParabolaEntityBundle:ProjectAllocation’); $query = $repository->createQueryBuilder(‘p’) ->where(‘p.startDate < :sdate and p.employee = :emp and

  • 0
$repository = $this->getDoctrine()->getRepository('ParabolaEntityBundle:ProjectAllocation');
        $query = $repository->createQueryBuilder('p')
                ->where('p.startDate < :sdate and p.employee = :emp and p.endDate > :edate')
                ->setParameter('sdate', date('Y-m-d', time()))
                ->setParameter('edate', date('Y-m-d', time()))
                ->setParameter('emp', $employee->getId())
                ->getQuery();
        $projectAllocate = $query->getResult();

how can i use above code in FormType class.I am using this query to generate array for the choice type in form builder.

  • 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-31T13:28:56+00:00Added an answer on May 31, 2026 at 1:28 pm

    I think you should use entity type instead which has a query_builder option.

    This link:

    http://symfony.com/doc/current/reference/forms/types/entity.html

    Describes how to do it.

    If, for some reason you really don’t want to use entity type, you could always retrieve data within controller and pass it via FormType constructor, which is a little bit quick ‘n’ dirty but should work just fine…

    Controller:

    $this->createForm(new MyFormType($results_from_qb), $form_data );
    

    FormType:

    public function __construct($results_from_qb){
        $this->results_from_qb = $results_from_qb; // store it into class member field to be used latter in buildForm method
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this code: public function showActiveJobsAction($slug) { $em = $this->getDoctrine()->getEntityManager(); $category = $em->getRepository('JobeetBundle:Category')->findBySlug($slug); if
Example: public bool Save(MyObj instance) { if (instance.IsNew) { this.repository.Create(instance); } else { this.repository.Update(instance);
I have a project that is stored in a Subversion repository. In this repository,
Some repository clones I have allow me to do this: % git pull %
I´m getting this error while trying to commit to a svn repository: svn: MKACTIVITY
Suppose my repository class looks like this: class myRepository : IDisposable{ private DataContext _context;
This question assumes there's a blessed central repository that members of a team clone
I have this sort of format asp.net MVC View -> Service Layer -> Repository.
If you do something like this in your Repository: IQueryable<CarClass> GetCars(string condition, params object[]
This is kind of similar to subversion merge - "has different repository root than"

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.