getColumnById
This commit is contained in:
@@ -65,6 +65,8 @@ class GetLinkColumnType extends \Espo\Core\Formula\Functions\Base implements
|
||||
$entityType = $this->getEntity()->getEntityType();
|
||||
$repository = $this->entityManager->getRDBRepository($entityType);
|
||||
|
||||
return $repository->getRelationColumn($this->getEntity(), $link, $id, $column);
|
||||
return $repository
|
||||
->getRelation($this->getEntity(), $link)
|
||||
->getColumnById($id, $column);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,7 +487,7 @@ class RDBRelation
|
||||
/**
|
||||
* Update relationship columns by ID. For many-to-many relationships.
|
||||
*
|
||||
* @param array<string,mixed> $columnData Role values.
|
||||
* @param array<string, mixed> $columnData Role values.
|
||||
*/
|
||||
public function updateColumnsById(string $id, array $columnData): void
|
||||
{
|
||||
@@ -606,6 +606,18 @@ class RDBRelation
|
||||
return $this->getMapper()->getRelationColumn($this->entity, $this->relationName, $id, $column);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a relationship column value by a foreign record ID. For many-to-many relationships.
|
||||
*/
|
||||
public function getColumnById(string $id, string $column): string|int|float|bool|null
|
||||
{
|
||||
if ($this->relationType !== Entity::MANY_MANY) {
|
||||
throw new RuntimeException("Can't get a column of not many-to-many relation.");
|
||||
}
|
||||
|
||||
return $this->getMapper()->getRelationColumn($this->entity, $this->relationName, $id, $column);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed>|null $columnData Role values.
|
||||
* @param array<string, mixed> $options
|
||||
|
||||
Reference in New Issue
Block a user