$valuePlaceholders =
array_fill(0, \
count($originalCategory), '?'
);
$insertStmt =
$this->connection->
prepare( 'INSERT INTO s_categories (`' .
implode('`, `',
array_keys($originalCategory)) . '`)
VALUES (' .
implode(', ',
$valuePlaceholders) . ')'
);
$insertStmt->
execute(array_values($originalCategory));
$newCategoryId =
(int) $this->connection->
lastInsertId();
$this->
rebuildPath($newCategoryId);
$this->
duplicateCategoryAttributes($originalCategoryId,
$newCategoryId);
$this->
duplicateCategoryRestrictions($originalCategoryId,
$newCategoryId);
if ($copyArticleAssociations) { $this->
duplicateCategoryArticleAssociations($originalCategoryId,
$newCategoryId);
} return $newCategoryId;
} /**
* Duplicates the category restrictions from one category to another
*
* @param int $originalCategoryId
* @param int $newCategoryId
*/