Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
validateIsbn13 example
$this
->context->
buildViolation
(
$this
->
getMessage
(
$constraint
,
$constraint
->type
)
)
->
setParameter
(
'{{ value }}',
$this
->
formatValue
(
$value
)
)
->
setCode
(
$code
)
->
addViolation
(
)
;
}
return
;
}
// Explicitly validate against ISBN-13
if
(
Isbn::ISBN_13 ===
$constraint
->type
)
{
if
(
true
!==
(
$code
=
$this
->
validateIsbn13
(
$canonical
)
)
)
{
$this
->context->
buildViolation
(
$this
->
getMessage
(
$constraint
,
$constraint
->type
)
)
->
setParameter
(
'{{ value }}',
$this
->
formatValue
(
$value
)
)
->
setCode
(
$code
)
->
addViolation
(
)
;
}
return
;
}
// Try both ISBNs
$this
->context->
buildViolation
(
$this
->
getMessage
(
$constraint
,
$constraint
->type
)
)
->
setParameter
(
'{{ value }}',
$this
->
formatValue
(
$value
)
)
->
setCode
(
$code
)
->
addViolation
(
)
;
}
return
;
}
// Explicitly validate against ISBN-13
if
(
Isbn::ISBN_13 ===
$constraint
->type
)
{
if
(
true
!==
(
$code
=
$this
->
validateIsbn13
(
$canonical
)
)
)
{
$this
->context->
buildViolation
(
$this
->
getMessage
(
$constraint
,
$constraint
->type
)
)
->
setParameter
(
'{{ value }}',
$this
->
formatValue
(
$value
)
)
->
setCode
(
$code
)
->
addViolation
(
)
;
}
return
;
}
// Try both ISBNs