lib/components/dataInterface/FieldMap.php
public function extractValue($caller, $foreignModel = null, $localModel = null)
    {
        if (is_null($foreignModel)) {
            $foreignModel = $this->foreignModel;
        }
        $foreignField = $this->foreignField;

        $value = null;
        if (isset($this->value)) {
            if (is_callable($this->value)) {
                $value = call_user_func($this->value, $foreignModel, $this);
            } else {
                $value = $this->value;
            }
        } elseif (isset($foreignField)) {
            if (is_callable($foreignField)) {
                $value = call_user_func($foreignField, $foreignModel);
            } elseif (!is_object($foreignField) && is_array($foreignField)) {
                $value = $caller->buildLocalAttributes($foreignModel, $localModel, $caller->buildMap($foreignField));
            } elseif (is_string($foreignField)) {
                $value = (isset($foreignModel->{$foreignField}) ? $foreignModel->{$foreignField} : null);
            }
        }

        if (is_object($value) && $value instanceof DataItem) {
            $object = $value->handle();
            if ($object) {
                $value = $object->primaryKey;
            } else {
                $value = null;
            }
        }
        if (!is_array($value)) {
            if (isset($this->filter)) {
                $value = call_user_func($this->filter, $value);
            }

            $value = $this->dataSource->universalFilter($value);
        }

        return $value;
    }
public function extractValue($caller, $foreignModel = null, $localModel = null)
    {
        if (is_null($foreignModel)) {
            $foreignModel = $this->foreignModel;
        }
        $foreignField = $this->foreignField;

        $value = null;
        if (isset($this->value)) {
            if (is_callable($this->value)) {
                $value = call_user_func($this->value, $foreignModel, $this);
            } else {
                $value = $this->value;
            }
        } elseif (isset($foreignField)) {
            if (is_callable($foreignField)) {
                $value = call_user_func($foreignField, $foreignModel);
            } elseif (!is_object($foreignField) && is_array($foreignField)) {
                $value = $caller->buildLocalAttributes($foreignModel, $localModel, $caller->buildMap($foreignField));
            } elseif (is_string($foreignField)) {
                $value = (isset($foreignModel->{$foreignField}) ? $foreignModel->{$foreignField} : null);
            }
        }

        if (is_object($value) && $value instanceof DataItem) {
            $object = $value->handle();
            if ($object) {
                $value = $object->primaryKey;
            } else {
                $value = null;
            }
        }
        if (!is_array($value)) {
            if (isset($this->filter)) {
                $value = call_user_func($this->filter, $value);
            }

            $value = $this->dataSource->universalFilter($value);
        }

        return $value;
    }
[[@doctodo method_description:extractValue]].

@param [[@doctodo param_type:caller]]       $caller       [[@doctodo param_description:caller]]
@param [[@doctodo param_type:foreignModel]] $foreignModel [[@doctodo param_description:foreignModel]] [optional]
@param [[@doctodo param_type:localModel]]   $localModel   [[@doctodo param_description:localModel]] [optional]

@return [[@doctodo return_type:extractValue]] [[@doctodo return_description:extractValue]]