Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
EnglishInflector example
$propName
=
$association
->
getPropertyName
(
)
;
if
(
mb_substr
(
$propName
, -1
)
=== 's' || \
in_array
(
$propName
, self::PLURAL_EXCEPTIONS, true
)
)
{
return
[
]
;
}
$ref
=
$this
->
getShortClassName
(
$this
->registry->
get
(
$association
->
getReferenceDefinition
(
)
->
getClass
(
)
)
)
;
$def
=
$this
->
getShortClassName
(
$definition
)
;
$ref
=
str_replace
(
$def
, '',
$ref
)
;
$refPlural
=
(
new
EnglishInflector
(
)
)
->
pluralize
(
$ref
)
[
0
]
;
if
(
mb_stripos
(
$propName
,
$refPlural
)
===
mb_strlen
(
$propName
)
-
mb_strlen
(
$refPlural
)
)
{
return
[
]
;
}
return
[
$definition
->
getClass
(
)
=>
[
sprintf
(
'Association %s.%s does not end with a \'s\'.',
$definition
->
getEntityName
(
)
,
$association
->
getPropertyName
(
)
)
,