CategoryRepositoryDeleter
in package
implements
CategoryRepositoryDeleterInterface
Class CategoryRepositoryDeleter
This class deletes category records from the database and is used in the category repository among the classes for writing and reading category records.
Tags
Interfaces, Classes and Traits
- CategoryRepositoryDeleterInterface
- Interface CategoryRepositoryDeleterInterface
Table of Contents
- $db : CI_DB_query_builder
- Database connector.
- $productRepository : ProductRepositoryInterface
- __construct() : mixed
- CategoryRepositoryDeleter constructor.
- deleteById() : CategoryRepositoryDeleter
- Deletes a specific category entity.
- deleteRelatedProductsOfCategory() : $this|CategoryRepositoryDeleterInterface
- Deletes related products of given category.
Properties
$db
Database connector.
protected
CI_DB_query_builder
$db
$productRepository
protected
ProductRepositoryInterface
$productRepository
Methods
__construct()
CategoryRepositoryDeleter constructor.
public
__construct(CI_DB_query_builder $db, ProductRepositoryInterface $productRepository) : mixed
Parameters
- $db : CI_DB_query_builder
-
Database connector.
- $productRepository : ProductRepositoryInterface
-
Products repository with functionality to remove products.
Return values
mixed —deleteById()
Deletes a specific category entity.
public
deleteById(IdType $categoryId) : CategoryRepositoryDeleter
Parameters
- $categoryId : IdType
-
Category ID.
Return values
CategoryRepositoryDeleter —Same instance for chained method calls.
deleteRelatedProductsOfCategory()
Deletes related products of given category.
public
deleteRelatedProductsOfCategory(IdCollection $categoryIds) : $this|CategoryRepositoryDeleterInterface
All products that are only connected to the given category gets removed.
Parameters
- $categoryIds : IdCollection
-
Ids of categories with products to be removed.
Return values
$this|CategoryRepositoryDeleterInterface —Same instance for chained method calls.