Protected Member Functions | |
_construct () | |
_afterSave (Mage_Core_Model_Abstract $object) |
Definition at line 35 of file Vote.php.
_afterSave | ( | Mage_Core_Model_Abstract $ | object | ) | [protected] |
Perform actions after object save
Varien_Object | $object |
Increase answer votes
Increase poll votes
Reimplemented from Mage_Core_Model_Mysql4_Abstract.
Definition at line 47 of file Vote.php.
00048 { 00049 /** 00050 * Increase answer votes 00051 */ 00052 $answerTable = $this->getTable('poll/poll_answer'); 00053 $pollAnswerData = array('votes_count' => new Zend_Db_Expr('votes_count+1')); 00054 $condition = $this->_getWriteAdapter()->quoteInto("{$answerTable}.answer_id=?", $object->getPollAnswerId()); 00055 $this->_getWriteAdapter()->update($answerTable, $pollAnswerData, $condition); 00056 00057 /** 00058 * Increase poll votes 00059 */ 00060 $pollTable = $this->getTable('poll/poll'); 00061 $pollData = array('votes_count' => new Zend_Db_Expr('votes_count+1')); 00062 $condition = $this->_getWriteAdapter()->quoteInto("{$pollTable}.poll_id=?", $object->getPollId()); 00063 $this->_getWriteAdapter()->update($pollTable, $pollData, $condition); 00064 return $this; 00065 }
_construct | ( | ) | [protected] |
Resource initialization
Reimplemented from Mage_Core_Model_Resource_Abstract.
Definition at line 37 of file Vote.php.
00038 { 00039 $this->_init('poll/poll_vote', 'vote_id'); 00040 }