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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:14:22+00:00 2026-06-15T23:14:22+00:00

DQL Code: $dql = SELECT a, FIELD(a.id, .$implodedIds.) as HIDDEN field . FROM \activity\models\Entities\Activity

  • 0

DQL Code:

$dql = "SELECT a, FIELD(a.id, ".$implodedIds.") as HIDDEN field " 
. "FROM \activity\models\Entities\Activity a "
. "WHERE a.id IN (".$implodedIds.") "
. "ORDER BY field ASC ";

$em = \Zend_Registry::get('em');

$doctrineConfig = $em->getConfiguration();
$doctrineConfig->addCustomStringFunction('FIELD', 'DoctrineExtensions\Query\Mysql\Field');

$query = $em->createQuery($dql);
$docResults = $query->getResult();

General Gist of Entity Structure: (Single Table Inheritance)

Activity
Opinion extends Activity
Comment extends Activity
Counter extends Activity

This dql code is returning Activity entities, however I want it to automatically discriminate the entities it returns into Opinions, Comments, and Counters. Doctrine does this without any issues in other instances, but not here for some reason. (I.E. in other cases where I make a query asking for Activity, it gives me an array of Opinions, Comments and Counters)

Can anybody tell me why this time, it’s not discriminating them automatically?

  • 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-06-15T23:14:23+00:00Added an answer on June 15, 2026 at 11:14 pm

    You ask the “activities”, and he returns to them! According to your schema options are “activities” … If you ask your options, you are more specific, and not get the other children of “activity” … So to differentiate, use “instanceOf”!

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

Sidebar

Related Questions

I have written a DQL query in Doctrine 2: $qb->select('r.position') ->from('\Entities\Races', 'r') ->where($qb->expr()->eq('r.entrantId', ':entrant_id'))
The Doctrine2 DQL allows for the following SQL : $query = $em->createQuery('SELECT u.id FROM
I want to order entities returned from a Doctrine query on a calculated scalar
I have following DQL (Doctrine1.2): $dql->select('sum(t.column1) column1, t.column2') ->from('Table t') ->groupBy('t.column2') ->orderBy('column1'); But the
A DQL query sample <?php $query = $em->createQuery('SELECT u FROM ForumUser u WHERE u.username
I'm trying ro execute this dql query SELECT DISTINCT a FROM Ipf\Model\Entity\Transaction t INNER
When I try to execute this DQL query: SELECT r, s FROM Rule r
Is there any chance to get DQL query from doctrine Query Builder object with
I'm trying to translate this (My)SQL to DQL SELECT content, created, AVG(rating) FROM point
When using this DQL $getImages = $em->createQuery('SELECT stuff FROM MyBundle:MyModelClass WHERE model.id NOT IN

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.