Mage_Poll_Model_Mysql4_Poll_Vote Class Reference

Inheritance diagram for Mage_Poll_Model_Mysql4_Poll_Vote:

Mage_Core_Model_Mysql4_Abstract Mage_Core_Model_Resource_Abstract

List of all members.

Protected Member Functions

 _construct ()
 _afterSave (Mage_Core_Model_Abstract $object)


Detailed Description

Definition at line 35 of file Vote.php.


Member Function Documentation

_afterSave ( Mage_Core_Model_Abstract object  )  [protected]

Perform actions after object save

Parameters:
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     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:34 2009 for Magento by  doxygen 1.5.8