ProductCategoryLinker
in package
implements
ProductCategoryLinkerInterface
Class ProductCategoryLinker
Tags
Interfaces, Classes and Traits
- ProductCategoryLinkerInterface
- Interface ProductCategoryLinkerInterface
Table of Contents
- $db : CI_DB_query_builder
- $tableName : string
- __construct() : mixed
- Initialize the product category linker.
- addProductToStartPage() : ProductRepositoryInterface|$this
- changeProductLink() : $this|ProductCategoryLinker
- Changes a link to a new category.
- deleteProductLink() : $this|ProductCategoryLinker
- Removes a link to a category.
- deleteProductLinks() : $this|ProductCategoryLinker
- Removes all links from a product.
- getProductLinks() : IdCollection
- Returns the category Ids which are linked with given product id.
- linkProduct() : $this|ProductCategoryLinker
- Links a product to a category.
- removeProductFromStartPage() : ProductRepositoryInterface|$this
Properties
$db
protected
CI_DB_query_builder
$db
$tableName
protected
string
$tableName
= 'products_to_categories'
Methods
__construct()
Initialize the product category linker.
public
__construct(CI_DB_query_builder $db) : mixed
Parameters
- $db : CI_DB_query_builder
-
Database connector.
Return values
mixed —addProductToStartPage()
public
addProductToStartPage(IdType $productId) : ProductRepositoryInterface|$this
Parameters
- $productId : IdType
Return values
ProductRepositoryInterface|$this —Same instance for chained method calls.
changeProductLink()
Changes a link to a new category.
public
changeProductLink(IdType $productId, IdType $currentCategoryId, IdType $newCategoryId) : $this|ProductCategoryLinker
Parameters
- $productId : IdType
-
Product ID.
- $currentCategoryId : IdType
-
Category ID which the product is linked to.
- $newCategoryId : IdType
-
New category to be linked to.
Return values
$this|ProductCategoryLinker —Same instance for chained method calls.
deleteProductLink()
Removes a link to a category.
public
deleteProductLink(IdType $productId, IdType $categoryId) : $this|ProductCategoryLinker
Parameters
- $productId : IdType
-
Product ID.
- $categoryId : IdType
-
Category ID which the link should be removed to.
Return values
$this|ProductCategoryLinker —Same instance for chained method calls.
deleteProductLinks()
Removes all links from a product.
public
deleteProductLinks(IdType $productId) : $this|ProductCategoryLinker
Parameters
- $productId : IdType
-
Product ID.
Return values
$this|ProductCategoryLinker —Same instance for chained method calls.
getProductLinks()
Returns the category Ids which are linked with given product id.
public
getProductLinks(IdType $productId) : IdCollection
Parameters
- $productId : IdType
-
Product ID.
Return values
IdCollection —linkProduct()
Links a product to a category.
public
linkProduct(IdType $productId, IdType $targetCategoryId) : $this|ProductCategoryLinker
Parameters
Return values
$this|ProductCategoryLinker —Same instance for chained method calls.
removeProductFromStartPage()
public
removeProductFromStartPage(IdType $productId) : ProductRepositoryInterface|$this
Parameters
- $productId : IdType
Return values
ProductRepositoryInterface|$this —Same instance for chained method calls.