Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
sortLanguages example
public
function
update
(
array
$ids
, Context
$context
)
: void
{
if
(
empty
(
$ids
)
)
{
return
;
}
$criteria
=
new
Criteria
(
)
;
$criteria
->
addFilter
(
new
NandFilter
(
[
new
EqualsFilter
(
'salesChannels.id', null
)
]
)
)
;
$languages
=
$this
->languageRepository->
search
(
$criteria
, Context::
createDefaultContext
(
)
)
->
getEntities
(
)
;
$languages
=
$this
->
sortLanguages
(
$languages
)
;
$products
=
[
]
;
foreach
(
$languages
as
$language
)
{
$languageContext
=
new
Context
(
new
SystemSource
(
)
,
[
]
,
Defaults::CURRENCY,
array_filter
(
[
$language
->
getId
(
)
,
$language
->
getParentId
(
)
, Defaults::LANGUAGE_SYSTEM
]
)
,
$context
->
getVersionId
(
)
)
;