Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
stringField example
$constraints
[
'cityName'
]
=
[
new
NotBlank
(
)
,
new
Type
(
'string'
)
]
;
return
$constraints
;
}
public
function
getConfig
(
)
: RuleConfig
{
return
(
new
RuleConfig
(
)
)
->
operatorSet
(
RuleConfig::OPERATOR_SET_STRING, true
)
->
stringField
(
'cityName'
)
;
}
}
return
[
'operator' => RuleConstraints::
stringOperators
(
false
)
,
'email' => RuleConstraints::
string
(
)
,
]
;
}
public
function
getConfig
(
)
: RuleConfig
{
return
(
new
RuleConfig
(
)
)
->
operatorSet
(
RuleConfig::OPERATOR_SET_STRING
)
->
stringField
(
'email'
)
;
}
private
function
matchPartially
(
CustomerEntity
$customer
)
: bool
{
if
(
$this
->email === null
)
{
throw
new
UnsupportedValueException
(
\
gettype
(
$this
->email
)
, self::
class
)
;
}
$email
=
str_replace
(
'\*', '(.*?)',
preg_quote
(
$this
->email, '/'
)
)
;
$regex
=
sprintf
(
'/^%s$/i',
$email
)
;
$constraints
[
'cityName'
]
=
[
new
NotBlank
(
)
,
new
Type
(
'string'
)
]
;
return
$constraints
;
}
public
function
getConfig
(
)
: RuleConfig
{
return
(
new
RuleConfig
(
)
)
->
operatorSet
(
RuleConfig::OPERATOR_SET_STRING, true
)
->
stringField
(
'cityName'
)
;
}
}
$constraints
[
'lastName'
]
= RuleConstraints::
string
(
)
;
return
$constraints
;
}
public
function
getConfig
(
)
: RuleConfig
{
return
(
new
RuleConfig
(
)
)
->
operatorSet
(
RuleConfig::OPERATOR_SET_STRING, true
)
->
stringField
(
'lastName'
)
;
}
}
$constraints
[
'streetName'
]
= RuleConstraints::
string
(
)
;
return
$constraints
;
}
public
function
getConfig
(
)
: RuleConfig
{
return
(
new
RuleConfig
(
)
)
->
operatorSet
(
RuleConfig::OPERATOR_SET_STRING, true
)
->
stringField
(
'streetName'
)
;
}
}
$constraints
[
'campaignCode'
]
= RuleConstraints::
string
(
)
;
return
$constraints
;
}
public
function
getConfig
(
)
: RuleConfig
{
return
(
new
RuleConfig
(
)
)
->
operatorSet
(
RuleConfig::OPERATOR_SET_STRING, true
)
->
stringField
(
'campaignCode'
)
;
}
}
$constraints
[
'affiliateCode'
]
= RuleConstraints::
string
(
)
;
return
$constraints
;
}
public
function
getConfig
(
)
: RuleConfig
{
return
(
new
RuleConfig
(
)
)
->
operatorSet
(
RuleConfig::OPERATOR_SET_STRING, true
)
->
stringField
(
'affiliateCode'
)
;
}
}
$constraints
[
'streetName'
]
= RuleConstraints::
string
(
)
;
return
$constraints
;
}
public
function
getConfig
(
)
: RuleConfig
{
return
(
new
RuleConfig
(
)
)
->
operatorSet
(
RuleConfig::OPERATOR_SET_STRING, true
)
->
stringField
(
'streetName'
)
;
}
}