Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a2ba73412 | |||
| cbee8cc541 |
@@ -74,6 +74,7 @@ abstract class Mapper implements IMapper
|
||||
if ($ps) {
|
||||
foreach ($ps as $row) {
|
||||
$entity = $this->fromRow($entity, $row);
|
||||
$entity->setAsFetched();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -118,8 +119,9 @@ abstract class Mapper implements IMapper
|
||||
|
||||
if ($this->returnCollection) {
|
||||
$collectionClass = $this->collectionClass;
|
||||
$entityArr = new $collectionClass($dataArr, $entity->getEntityType(), $this->entityFactory);
|
||||
return $entityArr;
|
||||
$collection = new $collectionClass($dataArr, $entity->getEntityType(), $this->entityFactory);
|
||||
$collection->setAsFetched();
|
||||
return $collection;
|
||||
} else {
|
||||
return $dataArr;
|
||||
}
|
||||
@@ -197,6 +199,7 @@ abstract class Mapper implements IMapper
|
||||
foreach ($ps as $row) {
|
||||
if (!$totalCount) {
|
||||
$relEntity = $this->fromRow($relEntity, $row);
|
||||
$relEntity->setAsFetched();
|
||||
return $relEntity;
|
||||
} else {
|
||||
return $row['AggregateValue'];
|
||||
@@ -237,13 +240,17 @@ abstract class Mapper implements IMapper
|
||||
|
||||
if ($relType == IEntity::HAS_ONE) {
|
||||
if (count($resultArr)) {
|
||||
return $this->fromRow($relEntity, $resultArr[0]);
|
||||
$relEntity = $this->fromRow($relEntity, $resultArr[0]);
|
||||
$relEntity->setAsFetched();
|
||||
return $relEntity;
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
if ($this->returnCollection) {
|
||||
$collectionClass = $this->collectionClass;
|
||||
return new $collectionClass($resultArr, $relEntity->getEntityType(), $this->entityFactory);
|
||||
$collection = new $collectionClass($resultArr, $relEntity->getEntityType(), $this->entityFactory);
|
||||
$collection->setAsFetched();
|
||||
return $collection;
|
||||
} else {
|
||||
return $resultArr;
|
||||
}
|
||||
@@ -282,7 +289,9 @@ abstract class Mapper implements IMapper
|
||||
}
|
||||
if ($this->returnCollection) {
|
||||
$collectionClass = $this->collectionClass;
|
||||
return new $collectionClass($resultArr, $relEntity->getEntityType(), $this->entityFactory);
|
||||
$collection = new $collectionClass($resultArr, $relEntity->getEntityType(), $this->entityFactory);
|
||||
$collection->setAsFetched();
|
||||
return $collection;
|
||||
} else {
|
||||
return $resultArr;
|
||||
}
|
||||
@@ -899,5 +908,3 @@ abstract class Mapper implements IMapper
|
||||
$this->collectionClass = $collectionClass;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -150,9 +150,6 @@ class EntityCollection implements \Iterator, \Countable, \ArrayAccess, \Seekable
|
||||
$value = $this->container[$offset];
|
||||
|
||||
if ($value instanceof Entity) {
|
||||
if ($this->isFetched) {
|
||||
$value->setAsFetched();
|
||||
}
|
||||
return $value;
|
||||
} else if (is_array($value)) {
|
||||
$this->container[$offset] = $this->buildEntityFromArray($value);
|
||||
|
||||
@@ -117,7 +117,6 @@ class RDB extends \Espo\ORM\Repository
|
||||
$params = array();
|
||||
$this->handleSelectParams($params);
|
||||
if ($this->getMapper()->selectById($entity, $id, $params)) {
|
||||
$entity->setAsFetched();
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@@ -253,11 +252,9 @@ class RDB extends \Espo\ORM\Repository
|
||||
return $collection;
|
||||
} else if ($result instanceof EntityCollection) {
|
||||
$collection = $result;
|
||||
$collection->setAsFetched();
|
||||
return $collection;
|
||||
} else if ($result instanceof Entity) {
|
||||
$entity = $result;
|
||||
$entity->setAsFetched();
|
||||
return $entity;
|
||||
} else {
|
||||
return $result;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "espocrm",
|
||||
"version": "5.2.0",
|
||||
"version": "5.2.1",
|
||||
"description": "",
|
||||
"main": "index.php",
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user