Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1368

incorrect mapping not detected by orm:validate-schema

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2
    • Component/s: Mapping Drivers, ORM, Tools
    • Security Level: All
    • Labels:
      None
    • Environment:
      Linux, Debian Lenny, PHP 5.3.8

      Description

      The following incorrect mapping was not detected by orm:validate-schema, instead running it resulted in:

      $ doctrine orm:validate-schema
      [Mapping] OK - The mapping files are correct.

      <doctrine-mapping>
      ...
      <one-to-many field="duchies" target-entity="Duchy" mapped-by="realm">
      <order-by>
      <order-by-field name="name" direction="ASC" />
      </order-by>
      </one-to-many>
      ...
      </doctrine-mapping>

      and the inverse side:

      <doctrine-mapping>
      <one-to-one field="realm" target-entity="Realm" inversed-by="duchies">
      <join-column name="Realm" referenced-column-name="ID" />
      </one-to-one>
      </doctrine-mapping>

      obviously, the inverse side should be many-to-one and not one-to-one. Interesting bugs in the code resulted. Obviously a coder mistake, but orm:validate-schema should have detected that the association has incompatible mappings.

        Activity

        Hide
        Benjamin Eberlei added a comment -

        Fixed

        Show
        Benjamin Eberlei added a comment - Fixed

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Tom Vogt
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: