Mage_SalesRule_Model_Mysql4_Rule_Customer Class Reference

Inheritance diagram for Mage_SalesRule_Model_Mysql4_Rule_Customer:

Mage_Core_Model_Mysql4_Abstract Mage_Core_Model_Resource_Abstract

List of all members.

Public Member Functions

 loadByCustomerRule ($rule, $customerId, $ruleId)

Protected Member Functions

 _construct ()


Detailed Description

Definition at line 29 of file Customer.php.


Member Function Documentation

_construct (  )  [protected]

Resource initialization

Reimplemented from Mage_Core_Model_Resource_Abstract.

Definition at line 31 of file Customer.php.

00032     {
00033         $this->_init('salesrule/rule_customer', 'rule_customer_id');
00034     }

loadByCustomerRule ( rule,
customerId,
ruleId 
)

Get rule usage record for a customer

Parameters:
Mage_SalesRule_Model_Rule_Customer $rule
int $customerId
int $ruleId
Returns:
Mage_SalesRule_Model_Mysql4_Rule_Customer

Definition at line 44 of file Customer.php.

00045     {
00046         $read = $this->_getReadAdapter();
00047         $select = $read->select()->from($this->getMainTable())
00048             ->where('customer_id=?', $customerId)
00049             ->where('rule_id=?', $ruleId);
00050         $data = $read->fetchRow($select);
00051         if (false === $data) {
00052             // set empty data, as an existing rule object might be used
00053             $data = array();
00054         }
00055         $rule->setData($data);
00056         return $this;
00057     }


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

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