diff --git a/lib/Doctrine/ORM/EntityManager.php b/lib/Doctrine/ORM/EntityManager.php index 4b5422d8a..a6e43f278 100644 --- a/lib/Doctrine/ORM/EntityManager.php +++ b/lib/Doctrine/ORM/EntityManager.php @@ -588,7 +588,6 @@ class EntityManager * * @param mixed $conn An array with the connection parameters or an existing * Connection instance. - * @param string $name The name of the EntityManager. * @param Configuration $config The Configuration instance to use. * @param EventManager $eventManager The EventManager instance to use. * @return EntityManager The created EntityManager. diff --git a/lib/Doctrine/ORM/Id/Assigned.php b/lib/Doctrine/ORM/Id/Assigned.php index dfd3cf0d4..ceaef2c05 100644 --- a/lib/Doctrine/ORM/Id/Assigned.php +++ b/lib/Doctrine/ORM/Id/Assigned.php @@ -49,16 +49,16 @@ class Assigned extends AbstractIdGenerator foreach ($idFields as $idField) { $value = $class->getReflectionProperty($idField)->getValue($entity); if (isset($value)) { - $identifier[] = $value; + $identifier[$idField] = $value; } else { throw ORMException::entityMissingAssignedId($entity); } } } else { - $value = $class->getReflectionProperty($class->getSingleIdentifierFieldName()) - ->getValue($entity); + $idField = $class->identifier[0]; + $value = $class->reflFields[$idField]->getValue($entity); if (isset($value)) { - $identifier[] = $value; + $identifier[$idField] = $value; } else { throw ORMException::entityMissingAssignedId($entity); } diff --git a/lib/Doctrine/ORM/Persisters/StandardEntityPersister.php b/lib/Doctrine/ORM/Persisters/StandardEntityPersister.php index cec6d5154..8bb1c15bb 100644 --- a/lib/Doctrine/ORM/Persisters/StandardEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/StandardEntityPersister.php @@ -183,7 +183,7 @@ class StandardEntityPersister //FIXME: Order with composite keys might not be correct $sql = "SELECT " . $versionFieldColumnName . " FROM " . $class->getQuotedTableName($this->_platform) . " WHERE " . implode(' = ? AND ', $identifier) . " = ?"; - $value = $this->_conn->fetchColumn($sql, array_values($id)); + $value = $this->_conn->fetchColumn($sql, array_values((array)$id)); $this->_class->setFieldValue($entity, $versionField, $value); } diff --git a/tests/Doctrine/Tests/ORM/Id/AssignedIdTest.php b/tests/Doctrine/Tests/ORM/Id/AssignedIdTest.php index 2c09bb36e..7bcae7779 100644 --- a/tests/Doctrine/Tests/ORM/Id/AssignedIdTest.php +++ b/tests/Doctrine/Tests/ORM/Id/AssignedIdTest.php @@ -42,13 +42,13 @@ class AssignedIdTest extends \Doctrine\Tests\OrmTestCase $entity = new AssignedSingleIdEntity; $entity->myId = 1; $id = $this->_assignedGen->generate($this->_em, $entity); - $this->assertEquals(array(1), $id); + $this->assertEquals(array('myId' => 1), $id); $entity = new AssignedCompositeIdEntity; $entity->myId2 = 2; $entity->myId1 = 4; $id = $this->_assignedGen->generate($this->_em, $entity); - $this->assertEquals(array(4, 2), $id); + $this->assertEquals(array('myId1' => 4, 'myId2' => 2), $id); } }