Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-588

EntityManager::refresh fails when ID columnName differs from fieldName

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-BETA1
    • Fix Version/s: 2.0-BETA2
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      doctrine2 @5dbd405

      Description

      Reproduce:

      /**
       * @Entity
       * @Table(name="site")
       */
      class Site
      {
          /**
           * @Id
           * @Column(type="integer", name="site_id")
           * @GeneratedValue
           */
          protected $id;
      
          /** @Column(type="string",length=45, unique=true) */
          protected $name;
      
          public function __construct($name = '')
          {
              $this->name = $name;
          }
      }
      
      $site = new Site('Foo');
      $em->persist($site);
      $em->flush();
      $em->refresh($site);
      

      Result:

      Doctrine\ORM\ORMException: Unrecognized field: site_id
      
      /Users/hobodave/dev/work/doctrine2/lib/Doctrine/ORM/ORMException.php:45
      /Users/hobodave/dev/work/doctrine2/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php:1042
      /Users/hobodave/dev/work/doctrine2/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php:783
      /Users/hobodave/dev/work/doctrine2/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php:571
      /Users/hobodave/dev/work/doctrine2/lib/Doctrine/ORM/UnitOfWork.php:1485
      /Users/hobodave/dev/work/doctrine2/lib/Doctrine/ORM/UnitOfWork.php:1461
      /Users/hobodave/dev/work/doctrine2/lib/Doctrine/ORM/EntityManager.php:431
      /Users/hobodave/dev/work/S5/tests/application/modules/common/services/SiteServiceTest.php:69
      

        Activity

        Show
        David Abdemoulaie added a comment - - edited Fixed in branch DDC-588 http://github.com/hobodave/doctrine2/commit/edf096eb57437521bbc40e49bcfc3fdbd747b501
        Hide
        Benjamin Eberlei added a comment -

        Is this fixed now or not?

        Show
        Benjamin Eberlei added a comment - Is this fixed now or not?
        Hide
        Roman S. Borschel added a comment -

        I think so. If not please reopen.

        Show
        Roman S. Borschel added a comment - I think so. If not please reopen.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: