Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-sales-rule
Model
ResourceModel
Rule
Customer.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\SalesRule\Model\ResourceModel\Rule
;
7
13
class
Customer
extends
\Magento\Framework\Model\ResourceModel\Db\AbstractDb
14
{
20
protected
function
_construct
()
21
{
22
$this->
_init
(
'salesrule_customer'
,
'rule_customer_id'
);
23
}
24
33
public
function
loadByCustomerRule
(
$rule
,
$customerId
,
$ruleId
)
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
}
Magento\Framework\Model\ResourceModel\Db\AbstractDb\getMainTable
getMainTable()
Definition:
AbstractDb.php:264
$rule
$rule
Definition:
rule_by_attribute.php:10
Magento\Framework\Model\ResourceModel\Db\AbstractDb\_init
_init($mainTable, $idFieldName)
Definition:
AbstractDb.php:186
$ruleId
$ruleId
Definition:
catalog_rule_10_off_not_logged_rollback.php:17
$select
$select
Definition:
catalog_rule_10_off_not_logged_rollback.php:14
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\SalesRule\Model\ResourceModel\Rule
Definition:
CollectionTest.php:6
Magento\SalesRule\Model\ResourceModel\Rule\Customer
Definition:
Customer.php:13
$customerId
$customerId
Definition:
quote_with_customer.php:16
Magento\Framework\Model\ResourceModel\Db\AbstractDb
Definition:
AbstractDb.php:24
Magento\SalesRule\Model\ResourceModel\Rule\Customer\loadByCustomerRule
loadByCustomerRule($rule, $customerId, $ruleId)
Definition:
Customer.php:33
$connection
$connection
Definition:
bulk.php:13
Magento\Framework\Model\ResourceModel\Db\AbstractDb\getConnection
getConnection()
Definition:
AbstractDb.php:325
Magento\SalesRule\Model\ResourceModel\Rule\Customer\_construct
_construct()
Definition:
Customer.php:20