Skip to content

EspoCRM – Open Source CRM Application

relation find return type change

Yuri Kuznetsovd329d037e673
diff --git a/application/Espo/ORM/Repository/RDBRelation.php b/application/Espo/ORM/Repository/RDBRelation.php
index cd49ac225a..335856780f 100644
--- a/application/Espo/ORM/Repository/RDBRelation.php
+++ b/application/Espo/ORM/Repository/RDBRelation.php
@@ -29,7 +29,6 @@
namespace Espo\ORM\Repository;
-use Espo\ORM\Collection;
use Espo\ORM\Defs\Params\RelationParam;
use Espo\ORM\Entity;
use Espo\ORM\EntityCollection;
@@ -45,6 +44,7 @@ use Espo\ORM\Query\Part\Expression;
use Espo\ORM\Query\Part\Order;
use Espo\ORM\Repository\RDBRelationSelectBuilder as Builder;
+use Espo\ORM\SthCollection;
use LogicException;
use RuntimeException;
@@ -149,9 +149,9 @@ class RDBRelation
/**
* Find related records.
*
- * @return Collection<TEntity>
+ * @return EntityCollection<TEntity>|SthCollection<TEntity>
*/
- public function find(): Collection
+ public function find(): EntityCollection|SthCollection
{
if ($this->isBelongsToParentType()) {
/** @var EntityCollection<TEntity> $collection */
diff --git a/application/Espo/ORM/Repository/RDBRelationSelectBuilder.php b/application/Espo/ORM/Repository/RDBRelationSelectBuilder.php
index ba8675faa5..c8c76afbd7 100644
--- a/application/Espo/ORM/Repository/RDBRelationSelectBuilder.php
+++ b/application/Espo/ORM/Repository/RDBRelationSelectBuilder.php
@@ -187,9 +187,9 @@ class RDBRelationSelectBuilder
/**
* Find related records by a criteria.
*
- * @return Collection<TEntity>
+ * @return EntityCollection<TEntity>|SthCollection<TEntity>
*/
- public function find(): Collection
+ public function find(): EntityCollection|SthCollection
{
$query = $this->builder->build();
@@ -198,6 +198,7 @@ class RDBRelationSelectBuilder
if ($related instanceof Collection) {
/** @var Collection<TEntity> $related */
+ /** @var EntityCollection<TEntity>|SthCollection<TEntity> */
return $this->handleReturnCollection($related);
}