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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:58:36+00:00 2026-06-03T04:58:36+00:00

In this example: http://www.doctrine-project.org/docs/orm/2.0/en/reference/dql-doctrine-query-language.html#single-table we see that SELECT e FROM Entities\Employee e WHERE e.name

  • 0

In this example:

http://www.doctrine-project.org/docs/orm/2.0/en/reference/dql-doctrine-query-language.html#single-table

we see that

SELECT e FROM Entities\Employee e WHERE e.name = 'test'

makes this query:

 SELECT p0_.id AS id0, p0_.name AS name1, p0_.department AS department2,
        p0_.discr AS discr3 FROM Person p0_ WHERE (p0_.name = ?) AND p0_.discr IN ('employee')

Is there a way to query records only with the discriminator “Person”?

This:

SELECT e FROM Entities\Person e WHERE e.name = 'test'

returns all the records.

Any ideas?

  • 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-03T04:58:37+00:00Added an answer on June 3, 2026 at 4:58 am

    By default the parent entity in a Inheritance Mapped Entity does not seem to use the Discriminator rules.

    I got round this by creating a base class/entity.

    /**
     * @Entity
     * @InheritanceType("SINGLE_TABLE")
     * @DiscriminatorColumn(name="discr", type="string")
     * @DiscriminatorMap({"person" = "Person", "employee" = "Employee"})
     */
    class PersonBase
    {
        /**
         * @Id @Column(type="integer")
         * @GeneratedValue
         */
        protected $id;
    
        /**
         * @Column(type="string", length=50)
         */
        protected $name;
    
        // ...
    
    }
    
    /**
     * @Entity
     */
    class Person extends PersonBase
    {
    }
    
    /**
     * @Entity
     */
    class Employee extends PersonBase
    {
        /**
         * @Column(type="string", length=50)
         */
        private $department;
    
        // ...
    }
    

    Now Person will use discriminator rules, you need never directly reference PersonBase.

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

Sidebar

Related Questions

I'm trying to follow this example http://www.boost.org/doc/libs/1_42_0/libs/serialization/doc/serialization.html#constructors but I keep getting errors. Following the
I found this example: http://www.yaml.org/YAML_for_ruby.html#extending_kernel::hash It's nice to see how easy YAML can serialize
I am trying use this example http://www.sajithmr.me/jrecorder/example2.html for recording audio and send it to
I'm following this example: http://www.codinghorror.com/blog/2005/12/getting-started-with-indexing-service.html However, the conversion to dataset shows empty columns for
Take a look at this example: http://www.extjs.com/deploy/dev/examples/multiselect/multiselect-demo.html On it, there are components rendered against
I'm using this plugin: http://www.jeremymartin.name/projects.php?project=kwicks And my code follows this example: http://www.jeremymartin.name/examples/kwicks.php?example=7 I'm using
Take this for example: http://www.haskell.org/haskellwiki/99_questions/Solutions/32 (**) Determine the greatest common divisor of two positive
I was trying to follow this example http://www.mulesoft.org/documentation/display/MULE3USER/Building+Web+Services+with+CXF on a legacy project so then
I am trying to implement this example http://www.javacodegeeks.com/2011/02/android-google-maps-tutorial.html and i have followed exactly all
I have following problem. I have a team page like this example: http://www.social-markets.de/social-commerce-team.html small

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.