Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-27

schema-tool --create creates a table for a mapped superclass

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0-ALPHA2
    • Component/s: Tools
    • Security Level: All
    • Labels:
      None

      Description

      Using the schema-tool to create the database creates a table for a mapped superclass. I think this behaviour is not desired, since the fields of the superclass also exist in the subclass tables. Running php doctrine schema-tool --create --dump-sql --classdir="<...>" generates the following output (MySql):

      CREATE TABLE Blameable (date_created DATETIME NOT NULL, date_updated DATETIME DEFAULT NULL,
      date_deleted DATETIME DEFAULT NULL, creator_id INT DEFAULT NULL, updater_id INT DEFAULT NULL,
      deleter_id INT DEFAULT NULL) ENGINE = InnoDB
      ALTER TABLE Blameable ADD FOREIGN KEY (creator_id) REFERENCES user_users(id)
      ALTER TABLE Blameable ADD FOREIGN KEY (updater_id) REFERENCES user_users(id)
      ALTER TABLE Blameable ADD FOREIGN KEY (deleter_id) REFERENCES user_users(id)

      Only the mapped superclass exists in the classdir. I think it should not create any tables.

        Activity

        Hide
        Ismo Toijala added a comment -

        Example class, used to generate output.

        Show
        Ismo Toijala added a comment - Example class, used to generate output.
        Hide
        Roman S. Borschel added a comment -

        Is this with ALPHA1 or the latest code from HEAD? I remember Jon making some fixes recently for mapped superclasses.

        Show
        Roman S. Borschel added a comment - Is this with ALPHA1 or the latest code from HEAD? I remember Jon making some fixes recently for mapped superclasses.
        Hide
        Ismo Toijala added a comment -

        This was with ALPHA1.

        Show
        Ismo Toijala added a comment - This was with ALPHA1.
        Hide
        Guilherme Blanco added a comment - - edited

        Are you able to try same thing with HEAD? If it works I can definately close the issue.

        Cheers,

        Show
        Guilherme Blanco added a comment - - edited Are you able to try same thing with HEAD? If it works I can definately close the issue. Cheers,
        Hide
        Ismo Toijala added a comment -

        This works now using HEAD.

        No SQL is outputted with --dump-sql and no tables are created for the mapped superclass.

        Show
        Ismo Toijala added a comment - This works now using HEAD. No SQL is outputted with --dump-sql and no tables are created for the mapped superclass.

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            Ismo Toijala
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: