Hero.php
00001 <?php
00012 class Dsao_Hero extends Dsao_Db_Table_DataHandler_Abstract
00013 {
00014
00015 protected $_valid;
00016
00017 protected $name;
00018
00019 protected $idUser;
00020
00024 protected $_reserialize = false;
00025
00026 protected $_table = 'hero_dsa3';
00027
00028 protected function _checkValidity()
00029 {
00030
00031
00032
00033
00034 $this->_valid = false;
00035
00036 return true;
00037 }
00038
00039 protected function _fetchAll()
00040 {
00041
00042 $select = $this->getTable()->getAdapter()->select()->from('hero_dsa3')
00043
00044 ->joinUsing('user_data', 'id');
00045
00046 $result = $this->getTable()->getAdapter()->fetchAll($select);
00047
00048
00049 $this->_parseResult(array_pop($result));
00050 }
00051
00052 public function exists()
00053 {
00054
00055 if (null !== ($exists = parent::exists()))
00056 {
00057 return $exists;
00058 }
00059
00060
00061 $select = $this->getTable()->select()->columns('id');
00062 $this->_addWhere($select);
00063
00064 return $this->_parseResult($select->fetchRow(), false);
00065 }
00066
00072 public function getReserialize()
00073 {
00074
00075 return ($this->_valid ? (bool) $this->_reserialize : false);
00076 }
00077
00078 public function refresh()
00079 {
00080 parent::refresh();
00081
00082 $this->_fetchAll();
00083
00084 return $this;
00085 }
00086
00087 public function insert()
00088 {
00089
00090 throw new Dsao_Exception('dsao_hero_insert');
00091 }
00092
00102 public function setReserialize($flag)
00103 {
00104 $this->_reserialize = (bool) $flag;
00105 }
00106
00107 public function update(array $properties = array())
00108 {
00109 parent::update($properties);
00110
00111
00112 $rowHeroData = Dsao_Registry::getTable('hero_dsa3')->find($this->__get('id'))->current();
00113
00114 $data = $this->getData($properties);
00115
00116
00117 $rowHeroData->setFromArray($data);
00118
00119
00120 $rowHeroData->save();
00121
00122 $this->setSynchronous(true);
00123
00124 return $this;
00125 }
00126 }