Exemple #1
0
 /**
  * @inheritdoc
  */
 public function getModel()
 {
     if (is_null($this->_model)) {
         $relationTabularId = RelationModel::generateTabularId($this->field);
         $attributes = empty($this->attributes) ? [] : $this->attributes;
         $taxonomy = false;
         if (isset($attributes['taxonomy_id'])) {
             $taxonomy = $attributes['taxonomy_id'];
             unset($attributes['taxonomy_id']);
         }
         $relationOptions = ['where' => $attributes, 'taxonomy' => $taxonomy];
         $this->model = $this->relationship->getPrimaryRelation($this->baseModel, $this->modelRole, $relationOptions);
         if (empty($this->_model)) {
             $this->model = $this->baseModel->getObjectRelationModel($this->field);
         }
         $this->_model->_moduleHandler = $this->field;
         if (empty($this->_model)) {
             \d("what");
             exit;
         }
     }
     return $this->_model;
 }