#1240 DDC-3479 - Fixing minor CS issues (naming, alignment)
This commit is contained in:
parent
8e4092750d
commit
66c556fbfd
@ -29,15 +29,21 @@ class EntityNotFoundException extends ORMException
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string $className
|
||||||
|
* @param string[] $id
|
||||||
*/
|
*/
|
||||||
public function __construct($class, array $id = array())
|
public function __construct($className, array $id = array())
|
||||||
{
|
{
|
||||||
$ids = array();
|
$ids = array();
|
||||||
|
|
||||||
foreach ($id as $key => $value) {
|
foreach ($id as $key => $value) {
|
||||||
$ids[] = "{$key}({$value})";
|
$ids[] = $key . '(' . $value . ')';
|
||||||
}
|
}
|
||||||
$idsFormatted = implode(', ', $ids);
|
|
||||||
$message = "Entity of type '" . $class . "'" . ($idsFormatted ? ' for IDs ' . $idsFormatted : '') . ' was not found';
|
|
||||||
parent::__construct($message);
|
parent::__construct(
|
||||||
|
'Entity of type \'' . $className . '\'' . ($ids ? ' for IDs ' . implode(', ', $ids) : '') . ' was not found'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,13 +147,17 @@ class ProxyFactory extends AbstractProxyFactory
|
|||||||
$proxy->__setInitialized(true);
|
$proxy->__setInitialized(true);
|
||||||
$proxy->__wakeup();
|
$proxy->__wakeup();
|
||||||
|
|
||||||
$id = $classMetadata->getIdentifierValues($proxy);
|
$identifier = $classMetadata->getIdentifierValues($proxy);
|
||||||
if (null === $entityPersister->loadById($id, $proxy)) {
|
|
||||||
|
if (null === $entityPersister->loadById($identifier, $proxy)) {
|
||||||
$proxy->__setInitializer($initializer);
|
$proxy->__setInitializer($initializer);
|
||||||
$proxy->__setCloner($cloner);
|
$proxy->__setCloner($cloner);
|
||||||
$proxy->__setInitialized(false);
|
$proxy->__setInitialized(false);
|
||||||
|
|
||||||
throw new EntityNotFoundException($classMetadata->getName(), $identifierFlattener->flattenIdentifier($classMetadata, $id));
|
throw new EntityNotFoundException(
|
||||||
|
$classMetadata->getName(),
|
||||||
|
$identifierFlattener->flattenIdentifier($classMetadata, $identifier)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -179,13 +183,17 @@ class ProxyFactory extends AbstractProxyFactory
|
|||||||
|
|
||||||
$proxy->__setInitialized(true);
|
$proxy->__setInitialized(true);
|
||||||
|
|
||||||
$id = $classMetadata->getIdentifierValues($proxy);
|
$identifier = $classMetadata->getIdentifierValues($proxy);
|
||||||
if (null === $entityPersister->loadById($id, $proxy)) {
|
|
||||||
|
if (null === $entityPersister->loadById($identifier, $proxy)) {
|
||||||
$proxy->__setInitializer($initializer);
|
$proxy->__setInitializer($initializer);
|
||||||
$proxy->__setCloner($cloner);
|
$proxy->__setCloner($cloner);
|
||||||
$proxy->__setInitialized(false);
|
$proxy->__setInitialized(false);
|
||||||
|
|
||||||
throw new EntityNotFoundException($classMetadata->getName(), $identifierFlattener->flattenIdentifier($classMetadata, $id));
|
throw new EntityNotFoundException(
|
||||||
|
$classMetadata->getName(),
|
||||||
|
$identifierFlattener->flattenIdentifier($classMetadata, $identifier)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -203,6 +211,7 @@ class ProxyFactory extends AbstractProxyFactory
|
|||||||
private function createCloner(ClassMetadata $classMetadata, EntityPersister $entityPersister)
|
private function createCloner(ClassMetadata $classMetadata, EntityPersister $entityPersister)
|
||||||
{
|
{
|
||||||
$identifierFlattener = $this->identifierFlattener;
|
$identifierFlattener = $this->identifierFlattener;
|
||||||
|
|
||||||
return function (BaseProxy $proxy) use ($entityPersister, $classMetadata, $identifierFlattener) {
|
return function (BaseProxy $proxy) use ($entityPersister, $classMetadata, $identifierFlattener) {
|
||||||
if ($proxy->__isInitialized()) {
|
if ($proxy->__isInitialized()) {
|
||||||
return;
|
return;
|
||||||
@ -211,12 +220,15 @@ class ProxyFactory extends AbstractProxyFactory
|
|||||||
$proxy->__setInitialized(true);
|
$proxy->__setInitialized(true);
|
||||||
$proxy->__setInitializer(null);
|
$proxy->__setInitializer(null);
|
||||||
|
|
||||||
$class = $entityPersister->getClassMetadata();
|
$class = $entityPersister->getClassMetadata();
|
||||||
$id = $classMetadata->getIdentifierValues($proxy);
|
$identifier = $classMetadata->getIdentifierValues($proxy);
|
||||||
$original = $entityPersister->loadById($id);
|
$original = $entityPersister->loadById($identifier);
|
||||||
|
|
||||||
if (null === $original) {
|
if (null === $original) {
|
||||||
throw new EntityNotFoundException($classMetadata->getName(), $identifierFlattener->flattenIdentifier($classMetadata, $id));
|
throw new EntityNotFoundException(
|
||||||
|
$classMetadata->getName(),
|
||||||
|
$identifierFlattener->flattenIdentifier($classMetadata, $identifier)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($class->getReflectionClass()->getProperties() as $property) {
|
foreach ($class->getReflectionClass()->getProperties() as $property) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user