Quick optimizations are always good.
This commit is contained in:
parent
e0fc09994c
commit
b98280a504
@ -705,15 +705,17 @@ class UnitOfWork implements PropertyChangedListener
|
||||
|
||||
foreach ($unwrappedValue as $key => $entry) {
|
||||
$state = $this->getEntityState($entry, self::STATE_NEW);
|
||||
$oid = spl_object_hash($entry);
|
||||
|
||||
if (!($entry instanceof $assoc['targetEntity'])) {
|
||||
throw new ORMException(sprintf("Found entity of type %s on association %s#%s, but expecting %s",
|
||||
get_class($entry),
|
||||
$assoc['sourceEntity'],
|
||||
$assoc['fieldName'],
|
||||
$targetClass->name
|
||||
));
|
||||
if ( ! ($entry instanceof $assoc['targetEntity'])) {
|
||||
throw new ORMException(
|
||||
sprintf(
|
||||
'Found entity of type %s on association %s#%s, but expecting %s',
|
||||
get_class($entry),
|
||||
$assoc['sourceEntity'],
|
||||
$assoc['fieldName'],
|
||||
$targetClass->name
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
switch ($state) {
|
||||
@ -1010,7 +1012,7 @@ class UnitOfWork implements PropertyChangedListener
|
||||
// are not yet available.
|
||||
$newNodes = array();
|
||||
|
||||
foreach ($entityChangeSet as $oid => $entity) {
|
||||
foreach ($entityChangeSet as $entity) {
|
||||
$className = get_class($entity);
|
||||
|
||||
if ($calc->hasClass($className)) {
|
||||
@ -1656,7 +1658,8 @@ class UnitOfWork implements PropertyChangedListener
|
||||
foreach ($id as $idField => $idValue) {
|
||||
if (isset($class->associationMappings[$idField])) {
|
||||
$targetClassMetadata = $this->em->getClassMetadata($class->associationMappings[$idField]['targetEntity']);
|
||||
$associatedId = $this->getEntityIdentifier($idValue);
|
||||
$associatedId = $this->getEntityIdentifier($idValue);
|
||||
|
||||
$flatId[$idField] = $associatedId[$targetClassMetadata->identifier[0]];
|
||||
}
|
||||
}
|
||||
@ -2418,9 +2421,9 @@ class UnitOfWork implements PropertyChangedListener
|
||||
case (isset($this->identityMap[$targetClass->rootEntityName][$relatedIdHash])):
|
||||
$newValue = $this->identityMap[$targetClass->rootEntityName][$relatedIdHash];
|
||||
|
||||
// if this is an uninitialized proxy, we are deferring eager loads,
|
||||
// If this is an uninitialized proxy, we are deferring eager loads,
|
||||
// this association is marked as eager fetch, and its an uninitialized proxy (wtf!)
|
||||
// then we cann append this entity for eager loading!
|
||||
// then we can append this entity for eager loading!
|
||||
if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
|
||||
isset($hints['deferEagerLoad']) &&
|
||||
!$targetClass->isIdentifierComposite &&
|
||||
@ -2515,13 +2518,13 @@ class UnitOfWork implements PropertyChangedListener
|
||||
$this->eagerLoadingEntities = array();
|
||||
|
||||
foreach ($eagerLoadingEntities as $entityName => $ids) {
|
||||
if ( ! $ids) continue;
|
||||
|
||||
$class = $this->em->getClassMetadata($entityName);
|
||||
|
||||
if ($ids) {
|
||||
$this->getEntityPersister($entityName)->loadAll(
|
||||
array_combine($class->identifier, array(array_values($ids)))
|
||||
);
|
||||
}
|
||||
$this->getEntityPersister($entityName)->loadAll(
|
||||
array_combine($class->identifier, array(array_values($ids)))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2901,7 +2904,7 @@ class UnitOfWork implements PropertyChangedListener
|
||||
*/
|
||||
public function isReadOnly($object)
|
||||
{
|
||||
if ( ! is_object($object) ) {
|
||||
if ( ! is_object($object)) {
|
||||
throw ORMInvalidArgumentException::readOnlyRequiresManagedEntity($object);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user