Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setPersonaCustomers example
$customer1
=
new
CustomerEntity
(
)
;
$customer1
->
setId
(
'C1'
)
;
$customer1
->
setCustomerNumber
(
'C1'
)
;
$customer2
=
new
CustomerEntity
(
)
;
$customer2
->
setId
(
'C2'
)
;
$customer2
->
setCustomerNumber
(
'C2'
)
;
$promotion
=
new
PromotionEntity
(
)
;
$promotion
->
setCustomerRestriction
(
true
)
;
$promotion
->
setPersonaCustomers
(
new
CustomerCollection
(
[
$customer1
,
$customer2
]
)
)
;
$custRule1
=
new
CustomerNumberRule
(
)
;
$custRule1
->
assign
(
[
'numbers' =>
[
'C1'
]
, 'operator' => Rule::OPERATOR_EQ
]
)
;
$custRule2
=
new
CustomerNumberRule
(
)
;
$custRule2
->
assign
(
[
'numbers' =>
[
'C2'
]
, 'operator' => Rule::OPERATOR_EQ
]
)
;
$expected
=
new
AndRule
(
[
// this is the customer rules OR condition
new
OrRule
(
[