CategoryRepositoryWriter
in package
implements
CategoryRepositoryWriterInterface
Class CategoryRepositoryWriter
This class provides methods for creating and updating specific category records in the database and is used in the category repository among the classes for reading and deleting category records.
Tags
Interfaces, Classes and Traits
- CategoryRepositoryWriterInterface
- Interface CategoryRepositoryWriterInterface
Table of Contents
- $categoriesTable : string
- $db : CI_DB_query_builder
- $languageProvider : LanguageProviderInterface
- __construct() : mixed
- CategoryRepositoryWriter constructor.
- insert() : int
- Inserts a category record into the database accordingly to the provided category object and returns the ID from the saved entity.
- update() : CategoryRepositoryWriter
- Updates an existing category record accordingly to the provided category object.
- _parseCategoryData() : mixed
- _parseCategoryDescriptionData() : mixed
Properties
$categoriesTable
protected
string
$categoriesTable
= 'categories'
$db
protected
CI_DB_query_builder
$db
$languageProvider
protected
LanguageProviderInterface
$languageProvider
Methods
__construct()
CategoryRepositoryWriter constructor.
public
__construct(CI_DB_query_builder $db, LanguageProviderInterface $languageProvider) : mixed
Parameters
- $db : CI_DB_query_builder
-
Database connector.
- $languageProvider : LanguageProviderInterface
Return values
mixed —insert()
Inserts a category record into the database accordingly to the provided category object and returns the ID from the saved entity.
public
insert(CategoryInterface $category) : int
Parameters
- $category : CategoryInterface
-
The category to insert.
Tags
Return values
int —Returns the ID of the new category.
update()
Updates an existing category record accordingly to the provided category object.
public
update(StoredCategoryInterface $category) : CategoryRepositoryWriter
Parameters
- $category : StoredCategoryInterface
-
The category to update.
Tags
Return values
CategoryRepositoryWriter —Same instance for chained method calls.
_parseCategoryData()
protected
_parseCategoryData(CategoryInterface $category) : mixed
Parameters
- $category : CategoryInterface
Return values
mixed —_parseCategoryDescriptionData()
protected
_parseCategoryDescriptionData(CategoryInterface $category, LanguageCode $languageCode) : mixed
Parameters
- $category : CategoryInterface
- $languageCode : LanguageCode