Пример #1
0
 /**
  * Remove object
  *
  * @param string $name
  * @return boolean
  */
 public function remove()
 {
     if ($this->_objectConfig->isLocked() || $this->_objectConfig->isReadOnly()) {
         $this->_errors[] = 'Can not remove locked object table ' . $this->_objectConfig->getName();
         return false;
     }
     try {
         $model = Model::factory($this->_objectName);
         if (!$this->tableExists()) {
             return true;
         }
         $sql = 'DROP TABLE `' . $model->table() . '`';
         $model->getDbConnection()->query($sql);
         $this->_logSql($sql);
         return true;
     } catch (Exception $e) {
         $this->_errors[] = $e->getMessage() . ' <br>SQL: ' . $sql;
         return false;
     }
 }