Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1209

DateTime (and other custom object types) cannot be used in primary key (singular or composite)

    Details

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

      Description

      This bug was encountered using a DateTime type as an @Id, but it appears that it will affect any type of custom data type if it is an object.

      Doctrine\ORM\Id\AssignedGenerator checks to see if the key is an object. If so it does a look up in the identity map to find the object, but in the case of DateTime it will not find it and throws an exception. It is appears this is the case for both singular and composite keys as shown in the attached test.

      Offending code: https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Id/AssignedGenerator.php#L52

      Test case forthcoming.

        Activity

        Michael Ridgway created issue -
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Benjamin Eberlei [ beberlei ] Guilherme Blanco [ guilhermeblanco ]
        Fix Version/s 2.1 [ 10022 ]
        Resolution Fixed [ 1 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 12716 ] jira-feedback [ 14903 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 14903 ] jira-feedback2 [ 16767 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 16767 ] jira-feedback3 [ 19020 ]

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Michael Ridgway
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: