CategoryWriteService

Implements \CategoryWriteServiceInterface

Class CategoryWriteService

This class provides methods for creating, updating and deleting categories data.

category

System

package

Category

implements

CategoryWriteServiceInterface

Methods

CategoryWriteService constructor.

__construct(\CategoryRepositoryInterface $categoryRepo, \AbstractFileStorage $categoryImageStorage, \AbstractFileStorage $categoryIconStorage, \AbstractFileStorage $categoryOpenGraphImageStorage, \ProductPermissionSetterInterface $productPermissionSetter, \UrlKeywordsRepairerInterface $urlKeywordsRepairer, \CacheControl $cacheControl) 

Arguments

$categoryRepo

\CategoryRepositoryInterface

Category repository.

$categoryImageStorage

\AbstractFileStorage

Category image.

$categoryIconStorage

\AbstractFileStorage

Category icon.

$categoryOpenGraphImageStorage

\AbstractFileStorage

Category OpenGraph image.

$productPermissionSetter

\ProductPermissionSetterInterface

ProductPermissionSetter.

$urlKeywordsRepairer

\UrlKeywordsRepairerInterface

Repairs urls.

$cacheControl

\CacheControl

Used to reset category cache.

Activates a specific category and its subcategories if desired.

activateCategory(\IdType $categoryId, \BoolType $includeSubcategories) : \CategoryWriteServiceInterface

Arguments

$categoryId

\IdType

Category ID of the category to activate.

$includeSubcategories

\BoolType

Shall the subcategories be activated also?

Response

\CategoryWriteServiceInterface

Same instance for chained method calls.

Stores a category in the database and returns the newly created ID of it.

createCategory(\CategoryInterface $category) : integer

Arguments

$category

\CategoryInterface

The category to store.

Response

integer

Returns the ID of the new category record.

Deactivates a specific category and its subcategories if desired.

deactivateCategory(\IdType $categoryId, \BoolType $includeSubcategories) : \CategoryWriteServiceInterface

Arguments

$categoryId

\IdType

Category ID of the category to deactivate.

$includeSubcategories

\BoolType

Shall the subcategories be deactivated also?

Response

\CategoryWriteServiceInterface

Same instance for chained method calls.

Deletes a category depending on the provided category ID.

deleteCategoryById(\IdType $categoryId) : \CategoryWriteService

Arguments

$categoryId

\IdType

Category ID of the category to delete.

Response

\CategoryWriteService

Same instance for chained method calls.

Deletes a category icon file.

deleteCategoryIconFile(\FilenameStringType $filename) : \CategoryWriteServiceInterface

Arguments

$filename

\FilenameStringType

Category icon file name.

Response

\CategoryWriteServiceInterface

Same instance for chained method calls.

Deletes a category image file.

deleteCategoryImageFile(\FilenameStringType $filename) : \CategoryWriteServiceInterface

Arguments

$filename

\FilenameStringType

Category image file name.

Response

\CategoryWriteServiceInterface

Same instance for chained method calls.

Deletes a category icon file.

deleteCategoryOpenGraphImageFile(\FilenameStringType $filename) : \CategoryWriteServiceInterface

Arguments

$filename

\FilenameStringType

Category icon file name.

Response

\CategoryWriteServiceInterface

Same instance for chained method calls.

Duplicates a category specified by its category ID.

duplicateCategory(\IdType $categoryId, \IdType $targetParentId, \BoolType $duplicateProducts = null, \BoolType $duplicateAttributes = null, \BoolType $duplicateSpecials = null, \BoolType $duplicateCrossSelling = null) : integer

This method duplicates the category which are identified by the provided category ID and links the duplicated category with the provided parent category ID. Containing subcategories and products will also be recursively duplicated with their attributes, specials and cross selling data depending on the last four arguments.

todo

Implement the last four arguments when finished in UML.

Arguments

$categoryId

\IdType

The category ID of the category to duplicate.

$targetParentId

\IdType

The target parent ID of the duplicated category.

$duplicateProducts

\BoolType

Should the products be duplicated?

$duplicateAttributes

\BoolType

Should the attributes be duplicated?

$duplicateSpecials

\BoolType

Should the specials be duplicated?

$duplicateCrossSelling

\BoolType

Should cross selling be duplicated?

Response

integer

Returns the ID of the new category record.

Imports an icon file and stores it.

importCategoryIconFile(\ExistingFile $sourceFile, \FilenameStringType $saveAsFilename) : string

Arguments

$sourceFile

\ExistingFile

The icon file to import.

$saveAsFilename

\FilenameStringType

The name under which the icon should be stored.

Response

string

The new filename.

Imports an image file and stores it.

importCategoryImageFile(\ExistingFile $sourceFile, \FilenameStringType $saveAsFilename) : string

Arguments

$sourceFile

\ExistingFile

The image file to import.

$saveAsFilename

\FilenameStringType

The name under which the image should to be stored.

Response

string

The new filename.

Imports an OpenGraph image file and stores it.

importCategoryOpenGraphImageFile(\ExistingFile $sourceFile, \FilenameStringType $saveAsFilename) : string

Arguments

$sourceFile

\ExistingFile

The image file to import.

$saveAsFilename

\FilenameStringType

The name under which the image should be stored.

Response

string

The new filename.

Moves a category into another category.

moveCategory(\IdType $categoryId, \IdType $newParentId) : \CategoryWriteService

This method moves a category specified by its category ID into another parent category specified by its category ID.

Arguments

$categoryId

\IdType

Category ID of the category to move.

$newParentId

\IdType

The new parent ID.

Response

\CategoryWriteService

Same instance for chained method calls.

Renames a category icon file.

renameCategoryIconFile(\FilenameStringType $oldName, \FilenameStringType $newName) : \CategoryWriteServiceInterface

Arguments

$oldName

\FilenameStringType

Old file name.

$newName

\FilenameStringType

New file name.

Response

\CategoryWriteServiceInterface

Same instance for chained method calls.

Renames a category image file.

renameCategoryImageFile(\FilenameStringType $oldName, \FilenameStringType $newName) : \CategoryWriteServiceInterface

Arguments

$oldName

\FilenameStringType

Old file name.

$newName

\FilenameStringType

New file name.

Response

\CategoryWriteServiceInterface

Same instance for chained method calls.

Renames a category OpenGraph image file.

renameCategoryOpenGraphImageFile(\FilenameStringType $oldName, \FilenameStringType $newName) : \CategoryWriteServiceInterface

Arguments

$oldName

\FilenameStringType

Old file name.

$newName

\FilenameStringType

New file name.

Response

\CategoryWriteServiceInterface

Same instance for chained method calls.

Sets the customer status permissions.

setCustomerStatusPermission(\IdType $categoryId, \IdType $customerStatusId, \BoolType $permitted, \BoolType $includeSubcategoriesAndProducts) : \CategoryWriteServiceInterface

The customer status permissions decides if the category is visible for a specific customer group. The permissions can be applied for subcategories also if desired.

Arguments

$categoryId

\IdType

Category ID.

$customerStatusId

\IdType

Customer status ID.

$permitted

\BoolType

Grant permission?

$includeSubcategoriesAndProducts

\BoolType

Grant permission including subcategories?

Response

\CategoryWriteServiceInterface

Same instance for chained method calls.

Updates the provided category and returns itself.

updateCategory(\StoredCategoryInterface $category) : \CategoryWriteService

Arguments

$category

\StoredCategoryInterface

The category to update.

Response

\CategoryWriteService

Same instance for chained method calls.

Properties

Category repository.

categoryRepo : \CategoryRepositoryInterface

Category image.

categoryImageStorage : \AbstractFileStorage
var

Type(s)

\AbstractFileStorage

Category icon.

categoryIconStorage : \AbstractFileStorage
var

Type(s)

\AbstractFileStorage

Category OpenGraph image.

categoryOpenGraphImageStorage : \AbstractFileStorage
var

Type(s)

\AbstractFileStorage

ProductPermissionSetter

productPermissionSetter : \ProductPermissionSetterInterface

Used for writing and repairing category's url keywords

urlKeywordsRepairer : \UrlKeywordsRepairerInterface

cacheControl

cacheControl : \CacheControl
var

Type(s)

\CacheControl