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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:58:04+00:00 2026-05-15T01:58:04+00:00

I am beginning to work with Symfony, I’ve found some documentation about inheritance. But

  • 0

I am beginning to work with Symfony, I’ve found some documentation about inheritance. But also found this discouraging article, which make me doubt if Doctrine handles inheritance any good at all…

Has anyone find a smart solution for inheritance in Symfony+Doctrine?

As an example, I have already structured the database something like this:

CREATE TABLE `poster` (
  `poster_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_name` varchar(50) NOT NULL,
  PRIMARY KEY (`poster_id`),
  UNIQUE KEY `id` (`poster_id`),
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

CREATE TABLE `user` (
  `user_id` int(11) NOT NULL,
  `real_name` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `user_id` (`user_id`),
  CONSTRAINT `user_fk` FOREIGN KEY (`user_id`) REFERENCES `poster` (`poster_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

From that, Doctrine generated this “schema.yml”:

Poster:
  connection: doctrine
  tableName: poster
  columns:
    poster_id:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true
    user_name:
      type: string(50)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
  relations:
    Post:
      local: poster_id
      foreign: poster_id
      type: many
    User:
      local: poster_id
      foreign: user_id
      type: many
    Version:
      local: poster_id
      foreign: poster_id
      type: many
User:
  connection: doctrine
  tableName: user
  columns:
    user_id:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: false
    real_name:
      type: string(50)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
  relations:
    Poster:
      local: user_id
      foreign: poster_id
      type: one

User creation for this structure with Doctrine auto-generated forms does not work.

Any clue will be appreciated.

  • 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-15T01:58:05+00:00Added an answer on May 15, 2026 at 1:58 am

    After several months working on a project using both column aggregation and concrete inheritance I can only say one thing : stay away from concrete inheritance ! Really.

    Let’s say you have 3 table : Media and Video/Audio which inherits from Media. You would expect to be able to do something like :

    Doctrine_Query::create()
        ->from('Media m')
        ->execute();
    

    Well it won’t work with concrete inheritance. It’s just worthless and has almost no practical use, except for model inheriting methods.

    On the other hand, with column aggregation, the Media table will have a “type” column automagically added, and will enable you to things such as :

    Doctrine_Query::create()
        ->from('Video v')
        ->execute();
    

    Which will return a Video object collection. But you could also do this :

    Doctrine_Query::create()
        ->from('Media m')
        ->execute();
    

    And you will get a mixed result of Video and Audio objects.

    Anyway you should check the doctrine documentation.
    But be careful as inheritance and doctrine can rapidly become troublesome.

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

Sidebar

Related Questions

I'm just beginning work with IIS, .NET, etc. so I apologize if any of
I am in the process of beginning work on several ASP.NET custom controls. I
Many beginning programmers write code like this: sub copy_file ($$) { my $from =
When beginning a new web project, i'm always a bit worried about removing pieces
I'm just beginning to have a look at Objective-C and Cocoa with a view
At the beginning of all my executable Python scripts I put the shebang line:
I'm really beginning to understand what people mean when they say that C++'s error
At the beginning of each PHP page I open up the connection to MySQL,
I'm at the beginning/middle of a project that we chose to implement using GWT.
We are beginning to go down the path of mobile browser support for an

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.