fix orm types
This commit is contained in:
@@ -36,7 +36,7 @@ use stdClass;
|
||||
* A collection of entities.
|
||||
*
|
||||
* @template TValue of Entity
|
||||
* @extends Traversable<TValue>
|
||||
* @bypass-extends Traversable<TValue>
|
||||
*
|
||||
* @todo Extend from Traversable once the min supported PHP version is 7.4. Remove bypass.
|
||||
*/
|
||||
|
||||
@@ -29,9 +29,10 @@
|
||||
|
||||
namespace Espo\ORM\Locker;
|
||||
|
||||
use Espo\ORM\QueryComposer\MysqlQueryComposer;
|
||||
|
||||
use Espo\ORM\{
|
||||
TransactionManager,
|
||||
QueryComposer\QueryComposer,
|
||||
Query\LockTableBuilder,
|
||||
};
|
||||
|
||||
@@ -51,7 +52,7 @@ class MysqlLocker implements Locker
|
||||
|
||||
private $isLocked = false;
|
||||
|
||||
public function __construct(PDO $pdo, QueryComposer $queryComposer, TransactionManager $transactionManager)
|
||||
public function __construct(PDO $pdo, MysqlQueryComposer $queryComposer, TransactionManager $transactionManager)
|
||||
{
|
||||
$this->pdo = $pdo;
|
||||
$this->queryComposer = $queryComposer;
|
||||
|
||||
@@ -164,9 +164,7 @@ class RDBRelationSelectBuilder
|
||||
{
|
||||
$transformedWhere = [];
|
||||
|
||||
$middleName = lcfirst(
|
||||
$this->entity->getRelationParam($this->relationName, 'relationName')
|
||||
);
|
||||
$middleName = lcfirst($this->getRelationParam('relationName'));
|
||||
|
||||
foreach ($where as $key => $value) {
|
||||
$transformedKey = $key;
|
||||
@@ -429,7 +427,7 @@ class RDBRelationSelectBuilder
|
||||
}
|
||||
|
||||
if (!$this->middleTableAlias) {
|
||||
$middleName = $this->entity->getRelationParam($this->relationName, 'relationName');
|
||||
$middleName = $this->getRelationParam('relationName');
|
||||
|
||||
if (!$middleName) {
|
||||
throw new RuntimeException("No relation name.");
|
||||
@@ -495,4 +493,24 @@ class RDBRelationSelectBuilder
|
||||
|
||||
return $this->entityManager->getCollectionFactory()->createFromSthCollection($collection);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
private function getRelationParam(string $param)
|
||||
{
|
||||
if ($this->entity instanceof BaseEntity) {
|
||||
return $this->entity->getRelationParam($this->relationName, $param);
|
||||
}
|
||||
|
||||
$entityDefs = $this->entityManager
|
||||
->getDefs()
|
||||
->getEntity($this->entity->getEntityType());
|
||||
|
||||
if (!$entityDefs->hasRelation($this->relationName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $entityDefs->getRelation($this->relationName)->getParam($param);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user