Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
BillingAddressSalutationMissingError example
if
(
$customer
=== null
)
{
return
;
}
if
(
$customer
->
getActiveBillingAddress
(
)
=== null ||
$customer
->
getActiveShippingAddress
(
)
=== null
)
{
// No need to add salutation-specific errors in this case
return
;
}
if
(
!
$customer
->
getActiveBillingAddress
(
)
->
getSalutationId
(
)
)
{
$errors
->
add
(
new
BillingAddressSalutationMissingError
(
$customer
->
getActiveBillingAddress
(
)
)
)
;
return
;
}
if
(
!
$customer
->
getActiveShippingAddress
(
)
->
getSalutationId
(
)
&&
$validateShipping
)
{
$errors
->
add
(
new
ShippingAddressSalutationMissingError
(
$customer
->
getActiveShippingAddress
(
)
)
)
;
}
}
public
function
reset
(
)
: void
{
$customer
->
setLastName
(
''
)
;
$address
=
new
CustomerAddressEntity
(
)
;
$address
->
setId
(
''
)
;
$address
->
setFirstName
(
''
)
;
$address
->
setLastName
(
''
)
;
$address
->
setZipcode
(
''
)
;
$address
->
setCity
(
''
)
;
return
[
new
ProfileSalutationMissingError
(
$customer
)
,
new
BillingAddressSalutationMissingError
(
$address
)
,
new
ShippingAddressSalutationMissingError
(
$address
)
,
]
;
}
/** * @param array<BundleFixture> $bundles */
private
function
createFinder
(
array
$bundles
)
: Environment
{
$loader
=
new
FilesystemLoader
(
__DIR__ . '/fixtures/Storefront/Resources/views'
)
;