mirror of
https://github.com/espocrm/espocrm.git
synced 2026-07-01 08:26:04 +00:00
24 lines
481 B
PHP
24 lines
481 B
PHP
<?php
|
|
|
|
namespace Espo\Core\ORM;
|
|
|
|
class Entity extends \Espo\ORM\Entity
|
|
{
|
|
public function loadLinkMultipleField($field)
|
|
{
|
|
if ($this->hasRelation($field) && $this->hasField($field . 'Ids')) {
|
|
$collection = $this->get($field);
|
|
$ids = array();
|
|
$names = new \stdClass();
|
|
foreach ($collection as $e) {
|
|
$id = $e->id;
|
|
$ids[] = $id;
|
|
$names->$id = $e->get('name');
|
|
}
|
|
$this->set($field . 'Ids', $ids);
|
|
$this->set($field . 'Names', $names);
|
|
}
|
|
}
|
|
}
|
|
|