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 900713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:26:07+00:00 2026-05-15T15:26:07+00:00

I have a Doctrine_Collection object that was created with code that looks something like.

  • 0

I have a Doctrine_Collection object that was created with code that looks something like.

$collection = Doctrine_Query::create()
->from('FooBazBar')
->where('widget_id = ?',$some_var)
->execute();

Short of writing it down somewhere, is it possible to to retrieve the where clause that was used to create the collection?

That is, I want to be able to so something like

$collection->getWhereClauses(); //fake method

And get back the where clause in some form.

A definitive “no, this isn’t exposed via the API” with an explanation is a perfectly reasonable answer here.

  • 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-15T15:26:08+00:00Added an answer on May 15, 2026 at 3:26 pm

    No, this isn’t exposed via the API.

    More seriously, you can’t retrieve the query that generated the Doctrine_Collection. The easy way to do this is to create a method in your table, like :

    //FooTable.php
    public function findByWidgetQuery()
    {
    return $this->createQuery('foo')
      ->where('foo.baz = ?', 'bar');
    }
    

    And then you can use getDqlPart() like this :

    $where = Doctrine_Core::getTable('Foo')
    ->findByWidgetQuery()
    ->getDqlPart('where');
    

    That should give you an array like this one :

    array(2) { [0] => string(8) 'widget = ?' [1] => string(10) 'widget = ?' }
    

    Note that it doesn’t return the actual value passed to the where() clause. To do this you need to use Doctrine_Query::getParams() or Doctrine_Query::getFlattenedParams()

    You can find everything in the Doctrine API.

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

Sidebar

Related Questions

I'm trying to create script, that will import keywords from images to database. Keywords
I have an object that has an instance of Doctrine\ODM\MongoDB\Query\Builder . When I serialize
I'm using Doctrine 1.2. I'd like to execute a Doctrine_Query that, instead of returning
I have two Doctrine entities that have a one-to-many relationship, like this: License class
I have the Array collection of objects like this Class User { private $tasks;
I have created an inherited document class, see the code below. The documents persists
I have a problem with saving the path in doctrine from a file upload.
I have an application that I'm converting to Symfony/Doctrine. It currently stores a serialized
I have a number of simple controller classes that use Doctrine's entity manager to
I'm using Symfony 1.2.7 and Doctrine 1.1. I have $activities (sfOutputEscaperIteratorDecorator - Doctrine_Collection) .

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.