Commit edf096eb authored by David Abdemoulaie's avatar David Abdemoulaie

[DDC-588] EntityManager::refresh uses fieldName instead of columnName

parent 8174f67a
...@@ -1480,7 +1480,7 @@ class UnitOfWork implements PropertyChangedListener ...@@ -1480,7 +1480,7 @@ class UnitOfWork implements PropertyChangedListener
$class = $this->_em->getClassMetadata(get_class($entity)); $class = $this->_em->getClassMetadata(get_class($entity));
if ($this->getEntityState($entity) == self::STATE_MANAGED) { if ($this->getEntityState($entity) == self::STATE_MANAGED) {
$this->getEntityPersister($class->name)->refresh( $this->getEntityPersister($class->name)->refresh(
array_combine($class->getIdentifierColumnNames(), $this->_entityIdentifiers[$oid]), array_combine($class->getIdentifierFieldNames(), $this->_entityIdentifiers[$oid]),
$entity $entity
); );
} else { } else {
......
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
require_once __DIR__ . '/../../../TestInit.php';
class DDC588Test extends \Doctrine\Tests\OrmFunctionalTestCase
{
protected function setUp()
{
parent::setUp();
$this->_schemaTool->createSchema(array(
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC588Site'),
));
}
public function testIssue()
{
$site = new DDC588Site('Foo');
$this->_em->persist($site);
$this->_em->flush();
// Following should not result in exception
$this->_em->refresh($site);
}
}
/**
* @Entity
*/
class DDC588Site
{
/**
* @Id
* @Column(type="integer", name="site_id")
* @GeneratedValue
*/
public $id;
/**
* @Column(type="string", length=45)
*/
protected $name = null;
public function __construct($name = '')
{
$this->name = $name;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment