class ProductRelationshipManager implements BasicEntityManagerInterface, JQGridInterface

Class ProductRelationshipManager is injected as empire_product_relationship_plugin.manager service. ProductRelationshipManager handles the logic for managed entity.

Traits

Trait JQGridManagerTrait

Properties

protected ProductRelationshipRepository $repository
protected ProductRelationshipEventContainer $container
protected ProductRelationshipName $relationshipNameDB

Methods

mixed
searchForJQGRID(array $searchParams, array $sortParams = array(), array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

No description

mixed
findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

No description

mixed
getCountForJQGRID(array|null $searchParams = null, array|null $sortParams = null, array|null $additionalParams = array(), JQGridWrapper|null $jqGridWrapper = null)

No description

__construct(ProductRelationshipRepository $repository, ProductRelationshipEventContainer $container)

ProductRelationshipManager constructor.

getRelationshipForProductId(int $productId, string $relationshipName)

Get relationship entity for specified product and relationship name

int
getRelationshipNameForRelationship(int $id)

Find product relationship name id by product relationship id

findOneById(int $id)

Find product relationship

editProductRelationship(ProductRelationship $productRelationship)

Create references to foreign entities and edit product relationship

saveNewRelationshipWithoutMainProduct(int $relationshipNameId)

Create reference to foreign entities and save product relationship

bool
deleteProductCrossRelationships(array $ids)

Remove product relationships for provided array of ids

array
doProductSearch(ProductSearchWrapper $searchWrapper)

Search for products

array
getProductsByRelationshipAndProductWithPagination(int $productId, int $relationshipNameId, int $relationshipId, int $page, int $offset, null $searchParams = null, array|null $sortParams = null, bool $isCount = false)

Get data for products in relationship

array
getRelationshipPagination(int $relationshipId, int $productId, int $page = 1, int $offset = 4)

Get data for products in relationship

array
getRelationshipPaginationCount(int $relationshipId, int $productId)

Get count of products for specified relationship

array
getRelationshipNames()

Get all relationship names

array
getRelationshipNamesForProduct(int $id)

Get relationship names for specified product

getRelationshipNameReference(int $id)

Get reference to ProductRelationshipName

array
getProductsForCategory(int $id)

Find products by category id

array|bool
getCategoriesForRelationship(int $relationshipId, int $productId, int $relationshipNameId)

Find categories for relationship

mixed
editProductRelationshipOrder(int $relationshipId, int $relationshipNameId, int $mainProductId, array $products)

Edit product relationship

bool
sortProductsInRelationship(int $productRelationshipProductId, int $mainProductId, int $relationshipNameId, ProductRelationship|bool $relationship, int $newIndex)

Save products sort in relationship

saveProductToRelationship(int $relationshipId, int $relationshipNameId, int $mainProductId, int $productId)

Create references to foreign entities and save or edit product relationship

bool
removeProductFromRelationship(int $relationshipId, int $relationshipNameId, int $mainProductId, int $productRelationshipProductId)

Remove product from product relationship

array|bool
saveCategoryProductsToRelationship(int $relationshipId, int $relationshipNameId, int $mainProductId, int $categoryId)

Save or edit category products in relationship

array|bool|PrimaryKeyInterface
removeCategoryProductsFromRelationship(int $relationshipId, int $relationshipNameId, int $mainProductId, int $categoryId)

Remove category product from relationship

changeProductRelationshipNameForRelationship(int $relationshipId, int $relationshipNameId)

Change product relationship name for relationship

array
getRelationshipByErCode(string $code)

Find relationship entity for specified code

bool|string
saveMultiple(array $relationships)

Save multiple product relationships

bool|string
updateMultiple(array $relationships)

Edit multiple product relationships

bool|string
deleteMultipleByIds(array $ids)

Delete multiple product relationships

bool
deleteProductRelationshipsWithErpCodeNOT(array $erpCodes, string $relationship)

Delete all product relationships where erp code is not in specified array

bool|string
deleteMultipleByErpCode(array $ids)

Delete all product relationships for provided array of erp codes

array
getProductIdsForRelationship(int $relationshipId, int $productId, int $page = 1, int $offset = 4, bool $concatResult = false)

Get ids of products for specified relationships

int
importProductsRelationshipsFromCSV(mixed $base64Content, mixed $relationshipNameId, mixed $fileName = '')

Import product relationships from CSV file This is only import for relationships that have main product TO DO (import without main product)

Details

in JQGridManagerTrait at line 26
mixed searchForJQGRID(array $searchParams, array $sortParams = array(), array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

Parameters

array $searchParams
array $sortParams
array $additionalParams
JQGridWrapper $jqGridWrapper

Return Value

mixed

in JQGridManagerTrait at line 40
mixed findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

Parameters

int $page
int $offset
array $sortParams
array $additionalParams
JQGridWrapper $jqGridWrapper

Return Value

mixed

in JQGridManagerTrait at line 53
mixed getCountForJQGRID(array|null $searchParams = null, array|null $sortParams = null, array|null $additionalParams = array(), JQGridWrapper|null $jqGridWrapper = null)

Parameters

array|null $searchParams
array|null $sortParams
array|null $additionalParams
JQGridWrapper|null $jqGridWrapper

Return Value

mixed

at line 59
__construct(ProductRelationshipRepository $repository, ProductRelationshipEventContainer $container)

ProductRelationshipManager constructor.

at line 72
ProductRelationship|bool getRelationshipForProductId(int $productId, string $relationshipName)

Get relationship entity for specified product and relationship name

Parameters

int $productId
string $relationshipName

Return Value

ProductRelationship|bool

at line 83
int getRelationshipNameForRelationship(int $id)

Find product relationship name id by product relationship id

Parameters

int $id

Return Value

int

at line 94
ProductRelationship findOneById(int $id)

Find product relationship

Parameters

int $id

Return Value

ProductRelationship

at line 105
ProductRelationship|bool|PrimaryKeyInterface editProductRelationship(ProductRelationship $productRelationship)

Create references to foreign entities and edit product relationship

Parameters

ProductRelationship $productRelationship

Return Value

ProductRelationship|bool|PrimaryKeyInterface

at line 164
ProductRelationship|PrimaryKeyInterface saveNewRelationshipWithoutMainProduct(int $relationshipNameId)

Create reference to foreign entities and save product relationship

Parameters

int $relationshipNameId

Return Value

ProductRelationship|PrimaryKeyInterface

at line 178
bool deleteProductCrossRelationships(array $ids)

Remove product relationships for provided array of ids

Parameters

array $ids

Return Value

bool

at line 189
array doProductSearch(ProductSearchWrapper $searchWrapper)

Search for products

Parameters

ProductSearchWrapper $searchWrapper

Return Value

array

at line 210
array getProductsByRelationshipAndProductWithPagination(int $productId, int $relationshipNameId, int $relationshipId, int $page, int $offset, null $searchParams = null, array|null $sortParams = null, bool $isCount = false)

Get data for products in relationship

Parameters

int $productId
int $relationshipNameId
int $relationshipId
int $page
int $offset
null $searchParams
array|null $sortParams
bool $isCount

Return Value

array

Exceptions

NoResultException
NonUniqueResultException

at line 240
array getRelationshipPagination(int $relationshipId, int $productId, int $page = 1, int $offset = 4)

Get data for products in relationship

Parameters

int $relationshipId
int $productId
int $page
int $offset

Return Value

array

at line 258
array getRelationshipPaginationCount(int $relationshipId, int $productId)

Get count of products for specified relationship

Parameters

int $relationshipId
int $productId

Return Value

array

Exceptions

NoResultException
NonUniqueResultException

at line 270
array getRelationshipNames()

Get all relationship names

Return Value

array

at line 281
array getRelationshipNamesForProduct(int $id)

Get relationship names for specified product

Parameters

int $id

Return Value

array

at line 296
ProductRelationshipName getRelationshipNameReference(int $id)

Get reference to ProductRelationshipName

Parameters

int $id

Return Value

ProductRelationshipName

Exceptions

ORMException

at line 307
array getProductsForCategory(int $id)

Find products by category id

Parameters

int $id

Return Value

array

at line 320
array|bool getCategoriesForRelationship(int $relationshipId, int $productId, int $relationshipNameId)

Find categories for relationship

Parameters

int $relationshipId
int $productId
int $relationshipNameId

Return Value

array|bool

at line 334
mixed editProductRelationshipOrder(int $relationshipId, int $relationshipNameId, int $mainProductId, array $products)

Edit product relationship

Parameters

int $relationshipId
int $relationshipNameId
int $mainProductId
array $products

Return Value

mixed

at line 377
bool sortProductsInRelationship(int $productRelationshipProductId, int $mainProductId, int $relationshipNameId, ProductRelationship|bool $relationship, int $newIndex)

Save products sort in relationship

Parameters

int $productRelationshipProductId
int $mainProductId
int $relationshipNameId
ProductRelationship|bool $relationship
int $newIndex

Return Value

bool

Exceptions

DBALException
NonUniqueResultException

at line 401
bool|PrimaryKeyInterface saveProductToRelationship(int $relationshipId, int $relationshipNameId, int $mainProductId, int $productId)

Create references to foreign entities and save or edit product relationship

Parameters

int $relationshipId
int $relationshipNameId
int $mainProductId
int $productId

Return Value

bool|PrimaryKeyInterface

Exceptions

ORMException

at line 452
bool removeProductFromRelationship(int $relationshipId, int $relationshipNameId, int $mainProductId, int $productRelationshipProductId)

Remove product from product relationship

Parameters

int $relationshipId
int $relationshipNameId
int $mainProductId
int $productRelationshipProductId

Return Value

bool

at line 497
array|bool saveCategoryProductsToRelationship(int $relationshipId, int $relationshipNameId, int $mainProductId, int $categoryId)

Save or edit category products in relationship

Parameters

int $relationshipId
int $relationshipNameId
int $mainProductId
int $categoryId

Return Value

array|bool

Exceptions

ORMException

at line 561
array|bool|PrimaryKeyInterface removeCategoryProductsFromRelationship(int $relationshipId, int $relationshipNameId, int $mainProductId, int $categoryId)

Remove category product from relationship

Parameters

int $relationshipId
int $relationshipNameId
int $mainProductId
int $categoryId

Return Value

array|bool|PrimaryKeyInterface

Exceptions

DBALException

at line 622
PrimaryKeyInterface changeProductRelationshipNameForRelationship(int $relationshipId, int $relationshipNameId)

Change product relationship name for relationship

Parameters

int $relationshipId
int $relationshipNameId

Return Value

PrimaryKeyInterface

Exceptions

ORMException

at line 638
array getRelationshipByErCode(string $code)

Find relationship entity for specified code

Parameters

string $code

Return Value

array

at line 649
bool|string saveMultiple(array $relationships)

Save multiple product relationships

Parameters

array $relationships

Return Value

bool|string

at line 660
bool|string updateMultiple(array $relationships)

Edit multiple product relationships

Parameters

array $relationships

Return Value

bool|string

at line 671
bool|string deleteMultipleByIds(array $ids)

Delete multiple product relationships

Parameters

array $ids

Return Value

bool|string

at line 685
bool deleteProductRelationshipsWithErpCodeNOT(array $erpCodes, string $relationship)

Delete all product relationships where erp code is not in specified array

Parameters

array $erpCodes
string $relationship

Return Value

bool

Exceptions

DBALException

at line 696
bool|string deleteMultipleByErpCode(array $ids)

Delete all product relationships for provided array of erp codes

Parameters

array $ids

Return Value

bool|string

at line 713
array getProductIdsForRelationship(int $relationshipId, int $productId, int $page = 1, int $offset = 4, bool $concatResult = false)

Get ids of products for specified relationships

Parameters

int $relationshipId
int $productId
int $page
int $offset
bool $concatResult

Return Value

array

Exceptions

NonUniqueResultException

at line 733
int importProductsRelationshipsFromCSV(mixed $base64Content, mixed $relationshipNameId, mixed $fileName = '')

Import product relationships from CSV file This is only import for relationships that have main product TO DO (import without main product)

Parameters

mixed $base64Content
mixed $relationshipNameId
mixed $fileName

Return Value

int

Exceptions

ORMException