Default Version Value identifier is always an array
This commit is contained in:
parent
c9e66e464d
commit
cb52782e5e
@ -281,8 +281,11 @@ class BasicEntityPersister implements EntityPersister
|
||||
$stmt->execute();
|
||||
|
||||
if ($isPostInsertId) {
|
||||
$id = $idGenerator->generate($this->em, $entity);
|
||||
$postInsertIds[$id] = $entity;
|
||||
$generatedId = $idGenerator->generate($this->em, $entity);
|
||||
$id = array(
|
||||
$this->class->identifier[0] => $generatedId
|
||||
);
|
||||
$postInsertIds[$generatedId] = $entity;
|
||||
} else {
|
||||
$id = $this->class->getIdentifierValues($entity);
|
||||
}
|
||||
@ -304,11 +307,11 @@ class BasicEntityPersister implements EntityPersister
|
||||
* entities version field.
|
||||
*
|
||||
* @param object $entity
|
||||
* @param mixed $id
|
||||
* @param array $id
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function assignDefaultVersionValue($entity, $id)
|
||||
protected function assignDefaultVersionValue($entity, array $id)
|
||||
{
|
||||
$value = $this->fetchVersionValue($this->class, $id);
|
||||
|
||||
@ -319,11 +322,11 @@ class BasicEntityPersister implements EntityPersister
|
||||
* Fetches the current version value of a versioned entity.
|
||||
*
|
||||
* @param \Doctrine\ORM\Mapping\ClassMetadata $versionedClass
|
||||
* @param mixed $id
|
||||
* @param array $id
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function fetchVersionValue($versionedClass, $id)
|
||||
protected function fetchVersionValue($versionedClass, array $id)
|
||||
{
|
||||
$versionField = $versionedClass->versionField;
|
||||
$tableName = $this->quoteStrategy->getTableName($versionedClass, $this->platform);
|
||||
@ -335,10 +338,6 @@ class BasicEntityPersister implements EntityPersister
|
||||
. ' FROM ' . $tableName
|
||||
. ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?';
|
||||
|
||||
if (!is_array($id)) {
|
||||
$id = array($this->class->identifier[0] => $id);
|
||||
}
|
||||
|
||||
$flatId = $this->identifierFlattener->flattenIdentifier($versionedClass, $id);
|
||||
|
||||
$value = $this->conn->fetchColumn($sql, array_values($flatId));
|
||||
|
@ -176,8 +176,11 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
|
||||
$rootTableStmt->execute();
|
||||
|
||||
if ($isPostInsertId) {
|
||||
$id = $idGenerator->generate($this->em, $entity);
|
||||
$postInsertIds[$id] = $entity;
|
||||
$generatedId = $idGenerator->generate($this->em, $entity);
|
||||
$id = array(
|
||||
$this->class->identifier[0] => $generatedId
|
||||
);
|
||||
$postInsertIds[$generatedId] = $entity;
|
||||
} else {
|
||||
$id = $this->em->getUnitOfWork()->getEntityIdentifier($entity);
|
||||
}
|
||||
@ -572,7 +575,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function assignDefaultVersionValue($entity, $id)
|
||||
protected function assignDefaultVersionValue($entity, array $id)
|
||||
{
|
||||
$value = $this->fetchVersionValue($this->getVersionedClassMetadata(), $id);
|
||||
$this->class->setFieldValue($entity, $this->class->versionField, $value);
|
||||
|
Loading…
Reference in New Issue
Block a user