Пример #1
0
 public function delete(Kwf_Model_Row_Interface $row)
 {
     foreach ($this->_rows[$row->getSubModelParentRow()->getInternalId()] as $k => $i) {
         if ($row === $i) {
             unset($this->_data[$row->getSubModelParentRow()->getInternalId()][$k]);
             unset($this->_rows[$row->getSubModelParentRow()->getInternalId()][$k]);
             $this->_updateParentRow($row->getSubModelParentRow());
             return;
         }
     }
     throw new Kwf_Exception("Can't find entry");
 }
 public function delete(Kwf_Model_Row_Interface $row)
 {
     $iId = $row->getSubModelParentRow()->getInternalId();
     if (!$row->field) {
         throw new Kwf_ClientException("field is required");
     }
     $sql = "ALTER TABLE ";
     $sql .= $row->getSubModelParentRow()->table . " ";
     $sql .= "DROP {$row->field}";
     $row->getSubModelParentRow()->getModel()->getDb()->query(trim($sql));
     foreach ($this->_rows[$iId] as $k => $i) {
         if ($row === $i) {
             unset($this->_data[$iId][$k]);
             unset($this->_rows[$iId][$k]);
             return;
         }
     }
     throw new Kwf_Exception("Can't find entry");
 }