$copyProductAssociations =
$this->
Request()->
getParam('reassignArticleAssociations'
);
$categoryIds =
$this->
Request()->
getParam('children'
);
if (!\
is_array($categoryIds)) { $categoryIds =
[$categoryIds];
} $newParentId =
(int) $this->
Request()->
getParam('categoryId'
);
$newParentId =
$newParentId === 0 ? 1 :
$newParentId;
$result =
[];
foreach ($categoryIds as $categoryId) { $newCategoryId =
$categoryDuplicator->
duplicateCategory( $categoryId,
$newParentId,
$copyProductAssociations );
$childrenStmt =
$this->
get('db'
)->
prepare('SELECT id FROM s_categories WHERE parent = :parent'
);
$childrenStmt->
execute([':parent' =>
$categoryId]);
$children =
$childrenStmt->
fetchAll(PDO::FETCH_COLUMN
);
if (\
count($children)) { $result[] =
[