Overview
  • Package
  • Class
  • Tree
  • Todo

Packages

  • AddonValue
    • Interfaces
  • ApiV2Controllers
  • Category
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Providers
    • Repositories
    • Storages
  • Customer
    • Address
    • Country
    • CountryZone
    • Interfaces
    • Validation
    • ValueObjects
  • Email
    • Collections
    • Entities
    • Exceptions
    • Interfaces
    • Repository
    • ValueObjects
  • Http
    • Collections
    • Exceptions
    • Factories
    • Interfaces
    • ValueObjects
  • Loaders
    • CrossCuttingLoader
    • GXCoreLoader
    • Interfaces
  • None
  • Order
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Repositories
    • Storages
    • ValueObjects
  • Product
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Providers
    • Repositories
    • Storages
  • ProductModule
    • Collections
    • Deleter
    • Entities
    • Factories
    • Interface
    • Interfaces
    • Reader
    • Repositories
    • Writer
  • Shared
    • Exceptions
    • FileSystem
    • Interfaces
    • Storage
    • Types
  • Statistics
    • Interfaces
  • UserConfiguration
    • Interfaces
    • Repository

Classes

  • CategoryObjectService
  • CategoryReadService
  • CategoryWriteService

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 CoreServices/Category/CategoryWriteService.inc.php

Methods summary

public
# __construct( CategoryRepositoryInterface $categoryRepo, AbstractFileStorage $categoryImageStorage, AbstractFileStorage $categoryIconStorage, ProductPermissionSetterInterface $productPermissionSetter )

CategoryWriteService constructor.

CategoryWriteService constructor.

Parameters

$categoryRepo
Category repository.
$categoryImageStorage
Category image.
$categoryIconStorage
Category icon.
$productPermissionSetter
ProductPermissionSetter.
public integer
# createCategory( CategoryInterface $category )

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

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

Parameters

$category
The category to store.

Returns

integer
Returns the ID of the new category record.

Implementation of

CategoryWriteServiceInterface::createCategory()
public CategoryWriteService
# updateCategory( StoredCategoryInterface $category )

Updates the provided category and returns itself.

Updates the provided category and returns itself.

Parameters

$category
The category to update.

Returns

CategoryWriteService
Same instance for chained method calls.

Implementation of

CategoryWriteServiceInterface::updateCategory()
public CategoryWriteService
# deleteCategoryById( IdType $categoryId )

Deletes a category depending on the provided category ID.

Deletes a category depending on the provided category ID.

Parameters

$categoryId
Category ID of the category to delete.

Returns

CategoryWriteService
Same instance for chained method calls.

Implementation of

CategoryWriteServiceInterface::deleteCategoryById()
public CategoryWriteService
# moveCategory( IdType $categoryId, IdType $newParentId )

Moves a category into another category.

Moves a category into another category.

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

Parameters

$categoryId
Category ID of the category to move.
$newParentId
The new parent ID.

Returns

CategoryWriteService
Same instance for chained method calls.

Implementation of

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

Duplicates a category specified by its category ID.

Duplicates a category specified by its category ID.

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
The category ID of the category to duplicate.
$targetParentId
The target parent ID of the duplicated category.
$duplicateProducts
Should the products be duplicated?
$duplicateAttributes
Should the attributes be duplicated?
$duplicateSpecials
Should the specials be duplicated?
$duplicateCrossSelling
Should cross selling be duplicated?

Returns

integer
Returns the ID of the new category record.

Todo

Implement the last four arguments when finished in UML.

Implementation of

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

Imports an image file and stores it.

Imports an image file and stores it.

Parameters

$sourceFile
The image file to import.
$saveAsFilename
The name under which the image should to be stored.

Returns

string
The new filename.

Implementation of

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

Imports an icon file and stores it.

Imports an icon file and stores it.

Parameters

$sourceFile
The icon file to import.
$saveAsFilename
The name under which the icon should be stored.

Returns

string
The new filename.

Implementation of

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

Renames a category image file.

Renames a category image file.

Parameters

$oldName
Old file name.
$newName
New file name.

Returns

CategoryWriteServiceInterface
Same instance for chained method calls.

Implementation of

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

Renames a category icon file.

Renames a category icon file.

Parameters

$oldName
Old file name.
$newName
New file name.

Returns

CategoryWriteServiceInterface
Same instance for chained method calls.

Implementation of

CategoryWriteServiceInterface::renameCategoryIconFile()
public CategoryWriteServiceInterface
# deleteCategoryImageFile( FilenameStringType $filename )

Deletes a category image file.

Deletes a category image file.

Parameters

$filename
Category image file name.

Returns

CategoryWriteServiceInterface
Same instance for chained method calls.

Implementation of

CategoryWriteServiceInterface::deleteCategoryImageFile()
public CategoryWriteServiceInterface
# deleteCategoryIconFile( FilenameStringType $filename )

Deletes a category icon file.

Deletes a category icon file.

Parameters

$filename
Category icon file name.

Returns

CategoryWriteServiceInterface
Same instance for chained method calls.

Implementation of

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

Activates a specific category and its subcategories if desired.

Activates a specific category and its subcategories if desired.

Parameters

$categoryId
Category ID of the category to activate.
$includeSubcategories
Shall the subcategories be activated also?

Returns

CategoryWriteServiceInterface
Same instance for chained method calls.

Implementation of

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

Deactivates a specific category and its subcategories if desired.

Deactivates a specific category and its subcategories if desired.

Parameters

$categoryId
Category ID of the category to deactivate.
$includeSubcategories
Shall the subcategories be deactivated also?

Returns

CategoryWriteServiceInterface
Same instance for chained method calls.

Implementation of

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

Sets the customer status permissions.

Sets the customer status permissions.

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
Category ID.
$customerStatusId
Customer status ID.
$permitted
Grant permission?
$includeSubcategoriesAndProducts
Grant permission including subcategories?

Returns

CategoryWriteServiceInterface
Same instance for chained method calls.

Implementation of

CategoryWriteServiceInterface::setCustomerStatusPermission()

Properties summary

protected CategoryRepositoryInterface $categoryRepo

Category repository.

Category repository.

#
protected AbstractFileStorage $categoryImageStorage

Category image.

Category image.

#
protected AbstractFileStorage $categoryIconStorage

Category icon.

Category icon.

#
protected ProductPermissionSetterInterface $productPermissionSetter

ProductPermissionSetter

ProductPermissionSetter

#
API documentation generated by ApiGen