phpDocumentor

CategoryWriteService
in package
implements CategoryWriteServiceInterface

Class CategoryWriteService

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

Tags
category

System

implements

CategoryWriteServiceInterface

Interfaces, Classes and Traits

CategoryWriteServiceInterface
Interface CategoryWriteServiceInterface

Table of Contents

$cacheControl  : CacheControl
$categoryIconStorage  : AbstractFileStorage
Category icon.
$categoryImageStorage  : AbstractFileStorage
Category image.
$categoryOpenGraphImageStorage  : AbstractFileStorage
Category OpenGraph image.
$categoryRepo  : CategoryRepositoryInterface
Category repository.
$productPermissionSetter  : ProductPermissionSetterInterface
ProductPermissionSetter
$urlKeywordsRepairer  : UrlKeywordsRepairerInterface
Used for writing and repairing category's url keywords
__construct()  : mixed
CategoryWriteService constructor.
activateCategory()  : CategoryWriteServiceInterface
Activates a specific category and its subcategories if desired.
createCategory()  : int
Stores a category in the database and returns the newly created ID of it.
deactivateCategory()  : CategoryWriteServiceInterface
Deactivates a specific category and its subcategories if desired.
deleteCategoryById()  : CategoryWriteService
Deletes a category depending on the provided category ID.
deleteCategoryIconFile()  : CategoryWriteServiceInterface
Deletes a category icon file.
deleteCategoryImageFile()  : CategoryWriteServiceInterface
Deletes a category image file.
deleteCategoryOpenGraphImageFile()  : CategoryWriteServiceInterface
Deletes a category icon file.
duplicateCategory()  : int
Duplicates a category specified by its category ID.
importCategoryIconFile()  : string
Imports an icon file and stores it.
importCategoryImageFile()  : string
Imports an image file and stores it.
importCategoryOpenGraphImageFile()  : string
Imports an OpenGraph image file and stores it.
moveCategory()  : CategoryWriteService
Moves a category into another category.
renameCategoryIconFile()  : CategoryWriteServiceInterface
Renames a category icon file.
renameCategoryImageFile()  : CategoryWriteServiceInterface
Renames a category image file.
renameCategoryOpenGraphImageFile()  : CategoryWriteServiceInterface
Renames a category OpenGraph image file.
setCustomerStatusPermission()  : CategoryWriteServiceInterface
Sets the customer status permissions.
updateCategory()  : CategoryWriteService
Updates the provided category and returns itself.

Properties

Methods

__construct()

CategoryWriteService constructor.

public __construct(CategoryRepositoryInterface $categoryRepo, AbstractFileStorage $categoryImageStorage, AbstractFileStorage $categoryIconStorage, AbstractFileStorage $categoryOpenGraphImageStorage, ProductPermissionSetterInterface $productPermissionSetter, UrlKeywordsRepairerInterface $urlKeywordsRepairer, CacheControl $cacheControl) : mixed
Parameters
$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.

Return values
mixed

createCategory()

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

public createCategory(CategoryInterface $category) : int
Parameters
$category : CategoryInterface

The category to store.

Return values
int

Returns the ID of the new category record.

duplicateCategory()

Duplicates a category specified by its category ID.

public duplicateCategory(IdType $categoryId, IdType $targetParentId[, BoolType $duplicateProducts = null ][, BoolType $duplicateAttributes = null ][, BoolType $duplicateSpecials = null ][, BoolType $duplicateCrossSelling = null ]) : int

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.

Parameters
$categoryId : IdType

The category ID of the category to duplicate.

$targetParentId : IdType

The target parent ID of the duplicated category.

$duplicateProducts : BoolType = null

Should the products be duplicated?

$duplicateAttributes : BoolType = null

Should the attributes be duplicated?

$duplicateSpecials : BoolType = null

Should the specials be duplicated?

$duplicateCrossSelling : BoolType = null

Should cross selling be duplicated?

Tags
todo

Implement the last four arguments when finished in UML.

Return values
int

Returns the ID of the new category record.

moveCategory()

Moves a category into another category.

public 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.

Parameters
$categoryId : IdType

Category ID of the category to move.

$newParentId : IdType

The new parent ID.

Return values
CategoryWriteService

Same instance for chained method calls.

setCustomerStatusPermission()

Sets the customer status permissions.

public 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.

Parameters
$categoryId : IdType

Category ID.

$customerStatusId : IdType

Customer status ID.

$permitted : BoolType

Grant permission?

$includeSubcategoriesAndProducts : BoolType

Grant permission including subcategories?

Return values
CategoryWriteServiceInterface

Same instance for chained method calls.

Search results