コード例 #1
0
ファイル: CMSNode.php プロジェクト: jcorbinredtree/cms
 public function delete()
 {
     $database = $this->getDatabase();
     $database->transaction();
     try {
         CMSPageNodeLink::deleteFor($this);
         parent::delete();
     } catch (Exception $e) {
         $database->rollback();
         throw $e;
     }
     $databsae->commit();
 }
コード例 #2
0
ファイル: CMSDBObject.php プロジェクト: jcorbinredtree/cms
        if (!isset($when)) {
            $when = time();
        }
        assert(is_int($when));
        if ($when < $this->modified) {
            throw new InvalidArgumentException("Won't roll back modified time");
        }
        if (isset($this->id)) {
            $database = $this->getDatabase();
            $meta = $this->meta();
            $sql = $this->meta()->getSQL('set_modified');
            $database->execute($sql, $when, $this->id);
        }
        $this->modified = $when;
    }
    protected function selfToData()
    {
        $data = parent::selfToData();
        $data['datatable'] = $this->data->serialize();
        return $data;
    }
    protected function dataToSelf($data, $save = true)
    {
        parent::dataToSelf($data, $save);
        if (array_key_exists('datatable', $data) && is_array($data['datatable'])) {
            $this->data->unserialize($data['datatable'], $save);
        }
    }
}
CMSDBObject::$CustomSQL = array_merge(CMSDBObject::$CustomSQL, CMSDBObjectDataTable::$CustomSQL);
コード例 #3
0
ファイル: CMSPage.php プロジェクト: jcorbinredtree/cms
 protected function dataToSelf($data, $save = true)
 {
     parent::dataToSelf($data, $save);
     if (isset($data['nodes'])) {
         $nodes = $data['nodes'];
         foreach ($nodes as $area => $ids) {
             $nodes[$area] = array_map(array('CMSNode', 'load'), $nodes[$area]);
         }
         if ($save) {
             $this->setNodes($nodes);
         } else {
             if (isset($this->linkedNodes)) {
                 $this->linkedNodes = null;
             }
             $this->fakeNodes = $nodes;
             return;
         }
     }
 }