Пример #1
0
 /**
  * Get interface object.
  *
  * @throws Exception [[@doctodo exception_description:Exception]]
  * @return [[@doctodo return_type:getInterfaceObject]] [[@doctodo return_description:getInterfaceObject]]
  *
  */
 public function getInterfaceObject()
 {
     if (is_null($this->_interfaceObject)) {
         $this->_interfaceObject = DataInterface::find()->where(['system_id' => $this->object->systemId])->one();
         if (empty($this->_interfaceObject)) {
             $this->_interfaceObject = new DataInterface();
             $this->_interfaceObject->name = $this->object->name;
             $this->_interfaceObject->system_id = $this->object->systemId;
             if (!$this->_interfaceObject->save()) {
                 var_dump($this->_interfaceObject->errors);
                 throw new Exception("Unable to save interface object!");
             }
         }
     }
     return $this->_interfaceObject;
 }