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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:18:43+00:00 2026-06-10T22:18:43+00:00

We are currently considering migrating our database code in php to Doctrine2. It seems

  • 0

We are currently considering migrating our database code in php to Doctrine2. It seems to us that most of the things we would like the do are possible with Doctrine2. There is only one thing which we are not sure if it is possible and how we should do that. Our database model can’t be changed right now because another project is using the same database. We can only change one thing at a time. Of course we are also curious how to improve the database model but that is not our main concern.

The issues is like this. We have a product table containing basic product information like this:

[product_id | code         | name          | description              | price]
 4            AS84GD         Steel brush    Strong steel brush.....     25.50
 28           HDD21N         Sand paper     Sand paper for wood.....     0.40

etc

We have different users for our product which al have different extra product properties. So we have an product_extra_field table which could look like this:

[extra_field_id | name]
 3                weight
 4                color
 9                supplier

and finally the table with the extra data product_extra_field_data

[product_id | extra_field_id | value]
 4            3                280
 4            4                brown
 4            9                company_x
 28           3                3
 28           4                yellow
 28           9                company_y

How do we right the necessary Doctrine2 code to get this data in one object, so we could have an object like this?

[Product]
Id : 4
Code : AS84GD
Name : Steel brush
Description : Strong steel brush.....
Price : 25.50
Weight : 280
Color : brown
Supplier : company_x

I’ve added a tag for Hibernate because I can read (N)Hibernate code and translate the ideas to Doctrine2.

  • 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-10T22:18:45+00:00Added an answer on June 10, 2026 at 10:18 pm

    So far, I don’t think you can achieve that with mapped superclasses.

    But, you could use native SQL within the doctrine result set mapping:

    http://docs.doctrine-project.org/en/latest/reference/native-sql.html

    Those are one of the drawbacks when mapping between objects and relational data, I mean, if you really want just one entity instead of replicating the relationships from the database.

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

Sidebar

Related Questions

I'm considering migrating from Subversion to Git at work, and would like to get
I'm currently designing a web application using php, javascript, and MySQL. I'm considering two
We are currently considering the option of migrating from svn to git for all
We are considering migrating to Sql Server 2005 Reporting Services. Many of our existing
We are currently considering using DotNetNuke as a base for our future portal-based and
I am currently working on a project. One library I would like to consider
Considering migrating an app to Heroku. Currently we build & test locally before deploying
I am currently considering if this is possible to do as a web app
I am currently looking at development IDEs and one that I am considering is
I am currently considering the best way of building a relatively complex page 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.