コード例 #1
0
ファイル: XmlParser.php プロジェクト: alexanderTsig/arabic
 function end($tag, $attributes, $cdata)
 {
     if (!$this->table) {
         return;
     }
     switch ($tag) {
         case 'row':
             if ($this->record && !$this->record->isLoaded()) {
                 $exist = false;
                 if ($fields = $this->record->getTable()->_checkUnique) {
                     $where = array();
                     foreach ($fields as $f) {
                         $where[$f] = isset($this->record->{$f}) ? $this->record->{$f} : null;
                     }
                     $records = $this->record->getTable()->findBy($where);
                     $exist = (bool) count($records);
                 }
                 if (!$exist) {
                     $this->record->insert();
                 }
             }
             $this->record = null;
             break;
         case 'field':
             if (!empty($this->record)) {
                 $this->record->set($attributes['name'], $cdata);
             }
             break;
     }
 }
コード例 #2
0
ファイル: WithData.php プロジェクト: alexanderTsig/arabic
 function delete()
 {
     $this->record->getAdapter()->query("DELETE FROM ?_data WHERE `table`=? AND `id`=?", $this->record->getTable()->getName(true), $this->record->pk());
     $this->data = array();
     $this->changedFields = array();
     $this->blobData = array();
     $this->blobFields = array();
     $this->deletedFields = array();
     $this->isLoaded = true;
 }