CategoryRepositoryWriter

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.

category

System

package

Category

subpackage

Repositories

Methods

CategoryRepositoryWriter constructor.

__construct(\CI_DB_query_builder $db, \LanguageProviderInterface $languageProvider) 

Arguments

$db

\CI_DB_query_builder

Database connector.

$languageProvider

\LanguageProviderInterface

_parseCategoryData

_parseCategoryData(\CategoryInterface $category) 

Arguments

$category

\CategoryInterface

_parseCategoryDescriptionData

_parseCategoryDescriptionData(\CategoryInterface $category, \LanguageCode $languageCode) 

Arguments

$category

\CategoryInterface

$languageCode

\LanguageCode

Inserts a category record into the database accordingly to the provided category object and returns the ID from the saved entity.

insert(\CategoryInterface $category) : integer
Throws
\UnexpectedValueException

When no language id was found by the given language code.

\InvalidArgumentException

Arguments

$category

\CategoryInterface

The category to insert.

Response

integer

Returns the ID of the new category.

Updates an existing category record accordingly to the provided category object.

update(\StoredCategoryInterface $category) : \CategoryRepositoryWriter
Throws
\UnexpectedValueException

When no language id was found by the given language code.

\InvalidArgumentException

Arguments

$category

\StoredCategoryInterface

The category to update.

Response

\CategoryRepositoryWriter

Same instance for chained method calls.

Properties

db

db : \CI_DB_query_builder
var

Type(s)

\CI_DB_query_builder

categoriesTable

categoriesTable : string
var

Type(s)

string

languageProvider

languageProvider : \LanguageProviderInterface