formula: parentName
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
@@ -65,6 +65,13 @@ class AttributeFetcher
|
||||
$methodName = 'getFetched';
|
||||
}
|
||||
|
||||
if ($entity->getAttributeParam($attribute, 'isParentName') && $methodName == 'get') {
|
||||
$relationName = $entity->getAttributeParam($attribute, 'relation');
|
||||
if ($parent = $entity->get($relationName)) {
|
||||
return $parent->get('name');
|
||||
}
|
||||
}
|
||||
|
||||
return $entity->$methodName($attribute);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,8 @@ class LinkParent extends Base
|
||||
$fieldName.'Name' => array(
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
'relation' => $fieldName,
|
||||
'isParentName' => true
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -383,6 +383,11 @@ abstract class Entity implements IEntity
|
||||
return null;
|
||||
}
|
||||
|
||||
public function hasFetched($attributeName)
|
||||
{
|
||||
return array_key_exists($attributeName, $this->fetchedValuesContainer);
|
||||
}
|
||||
|
||||
public function resetFetchedValues()
|
||||
{
|
||||
$this->fetchedValuesContainer = array();
|
||||
|
||||
Reference in New Issue
Block a user