Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Customer.php
Go to the documentation of this file.
1 <?php
7 
14 {
20  protected function _construct()
21  {
22  $this->_init('salesrule_customer', 'rule_customer_id');
23  }
24 
34  {
35  $connection = $this->getConnection();
36  $select = $connection->select()->from(
37  $this->getMainTable()
38  )->where(
39  'customer_id = :customer_id'
40  )->where(
41  'rule_id = :rule_id'
42  );
43  $data = $connection->fetchRow($select, [':rule_id' => $ruleId, ':customer_id' => $customerId]);
44  if (false === $data) {
45  // set empty data, as an existing rule object might be used
46  $data = [];
47  }
48  $rule->setData($data);
49  return $this;
50  }
51 }
loadByCustomerRule($rule, $customerId, $ruleId)
Definition: Customer.php:33
$connection
Definition: bulk.php:13