/** * Retrieve coupon/rule uses for specified customer * * @param \Magento\SalesRule\Model\Rule $rule * @param int $customerId * @return string */ public function getCustomerUses($rule, $customerId) { $connection = $this->getConnection(); $select = $connection->select()->from($this->getTable('rule_customer'), ['cnt' => 'count(*)'])->where('rule_id = :rule_id')->where('customer_id = :customer_id'); return $connection->fetchOne($select, [':rule_id' => $rule->getRuleId(), ':customer_id' => $customerId]); }
/** * Retrieve coupon/rule uses for specified customer * * @param \Magento\SalesRule\Model\Rule $rule * @param int $customerId * @return string */ public function getCustomerUses($rule, $customerId) { $read = $this->_getReadAdapter(); $select = $read->select()->from($this->getTable('rule_customer'), array('cnt' => 'count(*)'))->where('rule_id = :rule_id')->where('customer_id = :customer_id'); return $read->fetchOne($select, array(':rule_id' => $rule->getRuleId(), ':customer_id' => $customerId)); }