addAssignment example


        $assocProductsStmt->execute([':categoryID' => $originalCategoryId]);
        $products = $assocProductsStmt->fetchAll(PDO::FETCH_COLUMN, 0);

        if ($products) {
            $this->connection->query(
                'INSERT INTO s_articles_categories (categoryID, articleID) VALUES (' . $newCategoryId . ', ' . implode('), (' . $newCategoryId . ', ', $products) . ')'
            );

            foreach ($products as $productId) {
                $this->categoryDenormalization->addAssignment((int) $productId$newCategoryId);
            }
        }
    }

    /** * Rebuilds the path for a single category * * @param int $categoryId * @param string $categoryPath * * @return int */
public function backlogRemoveAssignment($articleId$categoryId)
    {
        $this->getCategoryComponent()->removeAssignment($articleId$categoryId);
    }

    /** * @param int $articleId * @param int $categoryId */
    public function backlogAddAssignment($articleId$categoryId)
    {
        $this->getCategoryComponent()->addAssignment($articleId$categoryId);
    }

    /** * @param int $articleId */
    public function backlogRemoveArticle($articleId)
    {
        $this->getCategoryComponent()->removeArticleAssignmentments($articleId);
    }

    /** * @param int $categoryId */
Home | Imprint | This part of the site doesn't use cookies.