Class CategoryWriteService

Class CategoryWriteService

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

CategoryWriteService implements CategoryWriteServiceInterface
Package: Category
Category: System
Implements: CategoryWriteServiceInterface
Located at Services/Core/Category/CategoryWriteService.inc.php

Methods summary

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

CategoryWriteService constructor.

public createCategory( CategoryInterface $category ) : integer

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

public updateCategory( StoredCategoryInterface $category ) : CategoryWriteService

Updates the provided category and returns itself.

public deleteCategoryById( IdType $categoryId ) : CategoryWriteService

Deletes a category depending on the provided category ID.

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

Moves a category into another category.

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

Duplicates a category specified by its category ID.

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

Imports an image file and stores it.

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

Imports an icon file and stores it.

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

Renames a category image file.

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

Renames a category icon file.

public deleteCategoryImageFile( FilenameStringType $filename ) : CategoryWriteServiceInterface

Deletes a category image file.

public deleteCategoryIconFile( FilenameStringType $filename ) : CategoryWriteServiceInterface

Deletes a category icon file.

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

Activates a specific category and its subcategories if desired.

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

Deactivates a specific category and its subcategories if desired.

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

Sets the customer status permissions.

Properties summary

protected $categoryRepo : CategoryRepositoryInterface

Category repository.


		
protected $categoryImageStorage : AbstractFileStorage

Category image.


		
protected $categoryIconStorage : AbstractFileStorage

Category icon.


		
protected $productPermissionSetter : ProductPermissionSetterInterface

ProductPermissionSetter


		
protected $urlKeywordsRepairer : UrlKeywordsRepairerInterface

Used for writing and repairing category's url keywords


		
protected $cacheControl : CacheControl