Skip to content

Loading…

DDC-588: EntityManager::refresh fails when ID columnName differs from fieldName #5093

Closed
doctrinebot opened this Issue · 4 comments

1 participant

@doctrinebot

Jira issue originally created by user @hobodave:

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
@doctrinebot

Comment created by @beberlei:

Is this fixed now or not?

@doctrinebot

Comment created by romanb:

I think so. If not please reopen.

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.0-BETA2 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.