class ProductRelationshipRepository extends EntityRepository

Class ProductRelationshipRepository is injected as empire_product_relationship_plugin.repository service. ProductRelationshipRepository is used for crud operation for entity.

Use this class to work with database.

Traits

Trait JQGridTrait
Class BaseRepositoryTrait. Used to provide generic CRUD operations for PrimaryKeyInterface entities

Constants

ALIAS

Alias for main entity

PRODUCT_RELATIONSHIP_PRODUCT_ALIAS

Alias for product relationship product table

MAIN_PRODUCT_ALIAS

Alias for main product

PRODUCT_ALIAS

Alias for product

CATEGORY_ALIAS

Alias for category

CATEGORY_PRODUCTS

Alias for category product

RELATIONSHIP_NAME_ALIAS

Alias for relationship name

Methods

jQGridJoinFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

All joins used in select.

jQGridGroupByFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

Should contain group by which jqgrid uses.

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

JQGrid function

array
searchForJQGRID(array $searchParams, array $sortParams, bool $isCountSearch = false, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

JQGrid function

save(PrimaryKeyInterface $object)

Save PrimaryKeyInterface entity

edit(PrimaryKeyInterface $object)

Edit PrimaryKeyInterface entity

bool
remove(PrimaryKeyInterface $object)

Delete PrimaryKeyInterface entity

boolean
deleteMultipleByIds(array $ids)

Delete multiple PrimaryKeyInterface entities by array of ids

boolean|string
deleteMultipleByField(string $field, array $values)

Delete multiple PrimaryKeyInterface entities by values of field

mixed
getReference(int $id, string|null $class = null)

Get reference to class

bool|string
saveMultiple(array $elements, int $flushNumber = 30)

Save multiple entities

bool|string
updateMultiple(array $elements, int $flushNumber = 30)

Edit multiple entities

bool|string
deleteMultiple(array $elements, int $flushNumber = 30)

Delete multiple enities

bool|Proxy|null|object
getReferenceForEntity(mixed $class, int $id)

Get reference

getRelationshipForProductId(int $productId, string $relationshipName)

Get relationship entity for specified product and relationship name

bool
sortProductsInRelationship(int $productRelationshipProductId, int $relationshipId, int $newIndex)

Sorts products within single relationship

bool
updatePrioritiesAfterDeletingCategory(mixed $relationshipId, mixed $deletedProductsIds)

Update product priorities within relationship after delete

bool
deleteProductRelationshipProduct(mixed $oldIndex, mixed $relationshipId)

Update all product priorities after precified index

bool
deleteProductRelationshipsWithErpCodeNOT(array $erpCodes, string $relationship)

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

array
getProductIdsForRelationship(mixed $relationshipId, mixed $productId, mixed $page, mixed $offset, bool $withoutMainProduct = false, bool $concatResult = false)

Get ids of products for specified relationships

array
getRelationshipPagination(int $relationshipId, int $productId, int $page, int $offset, bool $withoutMainProduct = false, bool $showUnavailable = false, array|null $searchParams = null, array|null $sortParams = null)

Get data for products in relationship

array
getRelationshipPaginationWithoutMain(mixed $relationshipId, mixed $productId, mixed $page, mixed $offset, array|null $searchParams = null, array|null $sortParams = null)

Get data for products in relationship when there is no main product

array
getRelationshipPaginationCount(int $relationshipId, int $productId, bool $withoutMainProduct = false, bool $showUnavailable = false, array|null $searchParams = null)

Get count of products for specified relationship

mixed
getRelationshipPaginationCountWithoutMain(int $relationshipId, int $productId, array|null $searchParams = null)

Get count for pagination without main products

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

Find categories for relationship

mixed
getMaxPriorityForRelationship(int $relationshipNameId, int $productId, int $relationshipId)

Get maximal priority for relationship

array
getRelationshipByErCode(string $code)

Get relationship entity for specified code

Details

in JQGridTrait at line 27
jQGridJoinFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

All joins used in select.

Override in the repository class if needed. Should do nothing otherwise

Parameters

QueryBuilder $qb
JQGridWrapper $jqGridWrapper

in JQGridTrait at line 42
jQGridGroupByFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

Should contain group by which jqgrid uses.

Override in the repository class if needed. Should do nothing otherwise

Parameters

QueryBuilder $qb
JQGridWrapper $jqGridWrapper

in JQGridTrait at line 61
array findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams, JQGridWrapper $jqGridWrapper)

JQGrid function

Parameters

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

Return Value

array

in JQGridTrait at line 94
array searchForJQGRID(array $searchParams, array $sortParams, bool $isCountSearch = false, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

JQGrid function

Parameters

array $searchParams
array $sortParams
bool $isCountSearch
array $additionalParams
JQGridWrapper $jqGridWrapper

Return Value

array

in BaseRepositoryTrait at line 27
PrimaryKeyInterface save(PrimaryKeyInterface $object)

Save PrimaryKeyInterface entity

Parameters

PrimaryKeyInterface $object

Return Value

PrimaryKeyInterface

in BaseRepositoryTrait at line 48
PrimaryKeyInterface edit(PrimaryKeyInterface $object)

Edit PrimaryKeyInterface entity

Parameters

PrimaryKeyInterface $object

Return Value

PrimaryKeyInterface

in BaseRepositoryTrait at line 69
bool remove(PrimaryKeyInterface $object)

Delete PrimaryKeyInterface entity

Parameters

PrimaryKeyInterface $object

Return Value

bool FALSE on error, TRUE otherwise

in BaseRepositoryTrait at line 88
boolean deleteMultipleByIds(array $ids)

Delete multiple PrimaryKeyInterface entities by array of ids

Parameters

array $ids

Return Value

boolean

in BaseRepositoryTrait at line 101
boolean|string deleteMultipleByField(string $field, array $values)

Delete multiple PrimaryKeyInterface entities by values of field

Parameters

string $field
  • Field which will be checked
array $values
  • Values to be deleted

Return Value

boolean|string

in BaseRepositoryTrait at line 130
mixed getReference(int $id, string|null $class = null)

Get reference to class

Parameters

int $id
  • Id og reference
string|null $class
  • Class of reference

Return Value

mixed

in BaseRepositoryTrait at line 143
bool|string saveMultiple(array $elements, int $flushNumber = 30)

Save multiple entities

Parameters

array $elements
int $flushNumber

Return Value

bool|string

in BaseRepositoryTrait at line 178
bool|string updateMultiple(array $elements, int $flushNumber = 30)

Edit multiple entities

Parameters

array $elements
int $flushNumber

Return Value

bool|string

in BaseRepositoryTrait at line 213
bool|string deleteMultiple(array $elements, int $flushNumber = 30)

Delete multiple enities

Parameters

array $elements
int $flushNumber

Return Value

bool|string

at line 78
bool|Proxy|null|object getReferenceForEntity(mixed $class, int $id)

Get reference

Parameters

mixed $class
int $id

Return Value

bool|Proxy|null|object

Exceptions

ORMException

at line 90
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 129
bool sortProductsInRelationship(int $productRelationshipProductId, int $relationshipId, int $newIndex)

Sorts products within single relationship

Parameters

int $productRelationshipProductId
int $relationshipId
int $newIndex

Return Value

bool

Exceptions

NonUniqueResultException
DBALException

at line 165
bool updatePrioritiesAfterDeletingCategory(mixed $relationshipId, mixed $deletedProductsIds)

Update product priorities within relationship after delete

Parameters

mixed $relationshipId
mixed $deletedProductsIds

Return Value

bool

Exceptions

DBALException

at line 190
bool deleteProductRelationshipProduct(mixed $oldIndex, mixed $relationshipId)

Update all product priorities after precified index

Parameters

mixed $oldIndex
mixed $relationshipId

Return Value

bool

at line 216
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 247
array getProductIdsForRelationship(mixed $relationshipId, mixed $productId, mixed $page, mixed $offset, bool $withoutMainProduct = false, bool $concatResult = false)

Get ids of products for specified relationships

Parameters

mixed $relationshipId
mixed $productId
mixed $page
mixed $offset
bool $withoutMainProduct
bool $concatResult

Return Value

array

Exceptions

NonUniqueResultException

at line 300
array getRelationshipPagination(int $relationshipId, int $productId, int $page, int $offset, bool $withoutMainProduct = false, bool $showUnavailable = false, array|null $searchParams = null, array|null $sortParams = null)

Get data for products in relationship

Parameters

int $relationshipId
int $productId
int $page
int $offset
bool $withoutMainProduct
bool $showUnavailable
array|null $searchParams
array|null $sortParams

Return Value

array

at line 406
array getRelationshipPaginationWithoutMain(mixed $relationshipId, mixed $productId, mixed $page, mixed $offset, array|null $searchParams = null, array|null $sortParams = null)

Get data for products in relationship when there is no main product

Parameters

mixed $relationshipId
mixed $productId
mixed $page
mixed $offset
array|null $searchParams
array|null $sortParams

Return Value

array

at line 489
array getRelationshipPaginationCount(int $relationshipId, int $productId, bool $withoutMainProduct = false, bool $showUnavailable = false, array|null $searchParams = null)

Get count of products for specified relationship

Parameters

int $relationshipId
int $productId
bool $withoutMainProduct
bool $showUnavailable
array|null $searchParams

Return Value

array

Exceptions

NoResultException
NonUniqueResultException

at line 534
mixed getRelationshipPaginationCountWithoutMain(int $relationshipId, int $productId, array|null $searchParams = null)

Get count for pagination without main products

Parameters

int $relationshipId
int $productId
array|null $searchParams

Return Value

mixed

Exceptions

NoResultException
NonUniqueResultException

at line 565
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 605
mixed getMaxPriorityForRelationship(int $relationshipNameId, int $productId, int $relationshipId)

Get maximal priority for relationship

Parameters

int $relationshipNameId
int $productId
int $relationshipId

Return Value

mixed

at line 639
array getRelationshipByErCode(string $code)

Get relationship entity for specified code

Parameters

string $code

Return Value

array