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