Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isNoAssociation example
$criteria
=
new
Criteria
(
)
;
$defaultFolderCriteria
=
new
Criteria
(
)
;
$defaultFolderCriteria
->
setOffset
(
0
)
;
$defaultFolderCriteria
->
setLimit
(
50
)
;
$defaultFolderCriteria
->
addAssociation
(
'folder.configuration'
)
;
/** @var RepositoryIterator<MediaDefaultFolderCollection> $iterator */
$iterator
=
new
RepositoryIterator
(
$this
->defaultFolderRepo,
$context
,
$defaultFolderCriteria
)
;
while
(
$defaultFolders
=
$iterator
->
fetch
(
)
)
{
foreach
(
$defaultFolders
->
getEntities
(
)
as
$defaultFolder
)
{
if
(
$this
->
isNoAssociation
(
$defaultFolder
)
)
{
$folder
=
$defaultFolder
->
getFolder
(
)
;
if
(
$folder
=== null
)
{
continue
;
}
$criteria
->
addFilter
(
new
MultiFilter
(
'OR',
[
new
NotFilter
(
'AND',
[
new
EqualsFilter
(
'mediaFolderId',
$folder
->
getId
(
)
)
,
]
)
,