Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1585

Doctrine2 doesn't check for the correct entity type on @ManyToOne relations

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.5
    • Fix Version/s: 2.2
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      I made a mistake when creating a @ManyToOne entity:

      /**

      • @ManyToOne(targetEntity="Entities\EntityA")
        */
        private $test;

      However, I was setting Entities\EntityB into $test.

      Doctrine2 doesn't check for this, resulting in a hard-to-find issue.

        Issue Links

          Activity

          Timo A. Hummel created issue -
          Hide
          Guilherme Blanco added a comment -

          Duplicated

          Show
          Guilherme Blanco added a comment - Duplicated
          Guilherme Blanco made changes -
          Field Original Value New Value
          Link This issue duplicates DDC-1586 [ DDC-1586 ]
          Hide
          Benjamin Eberlei added a comment -

          This is not a duplicate, its a runtime issue in the code when setting the wrong target entity type.

          Show
          Benjamin Eberlei added a comment - This is not a duplicate, its a runtime issue in the code when setting the wrong target entity type.
          Hide
          Benjamin Eberlei added a comment -

          Implemented an instanceof check.

          Show
          Benjamin Eberlei added a comment - Implemented an instanceof check.
          Benjamin Eberlei made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 2.2 [ 10157 ]
          Resolution Fixed [ 1 ]
          Benjamin Eberlei made changes -
          Workflow jira [ 13339 ] jira-feedback [ 15184 ]
          Benjamin Eberlei made changes -
          Workflow jira-feedback [ 15184 ] jira-feedback2 [ 17048 ]
          Benjamin Eberlei made changes -
          Workflow jira-feedback2 [ 17048 ] jira-feedback3 [ 19301 ]

          This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

          • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-1585, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              Timo A. Hummel
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: