Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
internalSetPath example
$parentId
=
$category
->
getParent
(
)
->
getId
(
)
;
$parents
=
$this
->
getCategoryComponent
(
)
->
getParentCategoryIds
(
$parentId
)
;
$path
=
implode
(
'|',
$parents
)
;
if
(
empty
(
$path
)
)
{
$path
= '';
}
else
{
$path
= '|' .
$path
. '|';
}
$category
->
internalSetPath
(
$path
)
;
return
$category
;
}
/** * @param int $articleId * @param int $categoryId */
public
function
backlogRemoveAssignment
(
$articleId
,
$categoryId
)
{
$this
->
getCategoryComponent
(
)
->
removeAssignment
(
$articleId
,
$categoryId
)
;
}
$item
->
setParent
(
$parent
)
;
$parents
=
$this
->
getCategoryComponent
(
)
->
getParentCategoryIds
(
$parentId
)
;
$path
=
implode
(
'|',
$parents
)
;
if
(
empty
(
$path
)
)
{
$path
= null;
}
else
{
$path
= '|' .
$path
. '|';
}
$item
->
internalSetPath
(
$path
)
;
$batchModeEnabled
=
Shopware
(
)
->
Config
(
)
->
get
(
'moveBatchModeEnabled'
)
;
if
(
$item
->
isLeaf
(
)
|| !
$batchModeEnabled
)
{
$needsRebuild
= false;
}
else
{
Shopware
(
)
->
Container
(
)
->
get
(
Shopware\Components\Model\CategorySubscriber::
class
)
->
disableForNextFlush
(
)
;
$needsRebuild
= true;
}
$this
->em->
flush
(
$item
)
;
}