lib/components/db/behaviors/RelatedObjects.php
public function setRelations($value)
    {
        if ($this->companionObject) {
            $baseObject = $this->companionObject;
        } else {
            $baseObject = $this->owner;
        }
        $fields = $baseObject->getFields();
        foreach ($value as $tabId => $relation) {
            if (!isset($relation['_moduleHandler'])) {
                \d("boom");
                exit;
                continue;
            }
            if (!isset($fields[$relation['_moduleHandler']])) {
                \d($relation['_moduleHandler']);
                \d(array_keys($fields));
                exit;
                continue;
            }
            $baseAttributes = [];
            $model = $fields[$relation['_moduleHandler']]->model;
            if (empty($model)) {
                $model = $fields[$relation['_moduleHandler']]->resetModel();
            }
            $model->attributes = $relation;
            $model->_moduleHandler = $relation['_moduleHandler'];
            $model->tabularId = $relation['_moduleHandler'];
            list($relationship, $role) = $baseObject->objectType->getRelationship($model->_moduleHandler);
            $relatedHandler = $baseObject->objectType->getRelatedType($model->_moduleHandler);
            if (!$relatedHandler) {
                continue;
            }
            if (!$this->owner->tabularId  // primary object
                && !$this->owner->isNewRecord
                && empty($model->parent_object_id)
                && empty($model->child_object_id)) {
                continue;
            }
            $this->_relations[$tabId] = $model;
        }
    }
public function setRelations($value)
    {
        if ($this->companionObject) {
            $baseObject = $this->companionObject;
        } else {
            $baseObject = $this->owner;
        }
        $fields = $baseObject->getFields();
        foreach ($value as $tabId => $relation) {
            if (!isset($relation['_moduleHandler'])) {
                \d("boom");
                exit;
                continue;
            }
            if (!isset($fields[$relation['_moduleHandler']])) {
                \d($relation['_moduleHandler']);
                \d(array_keys($fields));
                exit;
                continue;
            }
            $baseAttributes = [];
            $model = $fields[$relation['_moduleHandler']]->model;
            if (empty($model)) {
                $model = $fields[$relation['_moduleHandler']]->resetModel();
            }
            $model->attributes = $relation;
            $model->_moduleHandler = $relation['_moduleHandler'];
            $model->tabularId = $relation['_moduleHandler'];
            list($relationship, $role) = $baseObject->objectType->getRelationship($model->_moduleHandler);
            $relatedHandler = $baseObject->objectType->getRelatedType($model->_moduleHandler);
            if (!$relatedHandler) {
                continue;
            }
            if (!$this->owner->tabularId  // primary object
                && !$this->owner->isNewRecord
                && empty($model->parent_object_id)
                && empty($model->child_object_id)) {
                continue;
            }
            $this->_relations[$tabId] = $model;
        }
    }
Set relations.

@param [[@doctodo param_type:value]] $value [[@doctodo param_description:value]]