phpDocumentor

ProductWriteService
in package
implements ProductWriteServiceInterface

Class ProductWriteService

Tags
category

System

Interfaces, Classes and Traits

ProductWriteServiceInterface
Interface ProductWriteServiceInterface

Table of Contents

$deleteHistoryService  : DeleteHistoryWriteService
$envProductImagePathsSettings  : ProductImagePathsSettingsInterface
EnvProductImagePathsSettings.
$languageProvider  : LanguageProviderInterface
Used for fetching the language data.
$productImageStorage  : AbstractFileStorage
The product image storage.
$productLinker  : ProductCategoryLinkerInterface
The product category linker.
$productRepo  : ProductRepositoryInterface
The product repository.
$urlKeywordsRepairer  : UrlKeywordsRepairerInterface
Used for writing and repairing product's url keywords
__construct()  : mixed
ProductWriteService constructor.
changeProductLink()  : ProductWriteService
Changes the category link of a product.
createProduct()  : int
Create Product
deleteProductById()  : ProductWriteServiceInterface
Delete Product
deleteProductImage()  : ProductWriteService
Delete Product Image
deleteProductLink()  : ProductWriteService
Removes a category link from a product by the given product id.
deleteProductLinks()  : ProductWriteService
Removes all category links from a product by given product ID.
duplicateProduct()  : int
Duplicate Product
importProductImageFile()  : string
Import Product Image File
linkProduct()  : ProductWriteService
Link Product
processProductImage()  : ProductWriteService
Processes an image for the front end.
renameProductImage()  : ProductWriteService
Rename Product Image File
unlinkProduct()  : ProductWriteServiceInterface|$this
Unlink a product.
updateProduct()  : ProductWriteServiceInterface
Update Product
duplicateProductImage()  : ProductImageInterface
Duplicates a given Product Image and set the properties accordingly to the provided Source Product Image
imageCanBeRemoved()  : bool

Properties

Methods

__construct()

ProductWriteService constructor.

public __construct(ProductRepositoryInterface $productRepo, AbstractFileStorage $productImageStorage, ProductCategoryLinkerInterface $productLinker, ProductImagePathsSettingsInterface $envProductImagePathsSettings, LanguageProviderInterface $languageProvider, UrlKeywordsRepairerInterface $urlKeywordsRepairer, DeleteHistoryWriteService $deleteHistoryService) : mixed
Parameters
$productRepo : ProductRepositoryInterface
$productImageStorage : AbstractFileStorage
$productLinker : ProductCategoryLinkerInterface
$envProductImagePathsSettings : ProductImagePathsSettingsInterface
$languageProvider : LanguageProviderInterface
$urlKeywordsRepairer : UrlKeywordsRepairerInterface
$deleteHistoryService : DeleteHistoryWriteService
Return values
mixed

createProduct()

Create Product

public createProduct(ProductInterface $product) : int

Creates a new product and returns the ID of it.

Parameters
$product : ProductInterface

The product to create.

Tags
throws
InvalidArgumentException

Through "linkProduct" method.

Return values
int

The ID of the created product.

duplicateProduct()

Duplicate Product

public duplicateProduct(IdType $productId, IdType $targetCategoryId[, BoolType $duplicateAttributes = null ][, BoolType $duplicateSpecials = null ][, BoolType $duplicateCrossSelling = null ]) : int

Duplicates a product to a category.

Parameters
$productId : IdType

The product ID of the product to duplicate.

$targetCategoryId : IdType

The target category ID of the product to be duplicated to.s

$duplicateAttributes : BoolType = null

Should the attributes be duplicated also?

$duplicateSpecials : BoolType = null

Should the specials be duplicated also?

$duplicateCrossSelling : BoolType = null

Should cross selling be duplicated also?

Tags
throws
InvalidArgumentException

If "$newProductId" is not an integer.

todo

Implement the last three arguments when finished in UML.

Return values
int

Returns the ID of the new product.

importProductImageFile()

Import Product Image File

public importProductImageFile(ExistingFile $sourceFile, FilenameStringType $preferredFilename) : string

Imports an image for the product.

Parameters
$sourceFile : ExistingFile

The existing file to import.

$preferredFilename : FilenameStringType

The preferred filename.

Tags
throws
InvalidArgumentException

If the provided source file or the preferred filename is not valid.

Return values
string

The new filename.

renameProductImage()

Rename Product Image File

public renameProductImage(FilenameStringType $oldName, FilenameStringType $newName) : ProductWriteService

Renames a product image file.

Parameters
$oldName : FilenameStringType

The old name of the product image file.

$newName : FilenameStringType

The new name of the product image file.

Tags
throws
InvalidArgumentException

If the provided old name or new name is not valid.

Return values
ProductWriteService

Same instance for chained method calls.

Search results