class CompareManager implements BasicEntityManagerInterface

Class CompareManager is injected as empire_compare_plugin.compare_manager service. CompareManager handles the logic for managed entity.

Properties

protected CompareRepository $repository
protected ProductCompareEventContainer $eventContainer

Methods

__construct(CompareRepository $repository, ProductCompareEventContainer $eventContainer)

CompareManager constructor.

string
translate(String $messageToTranslate)

Translate message

getOneById(int $id)

Find compare list by id

save(Compare $compareList)

Create reference to user and persist new compare list

bool
deleteCompareList(int $compareListID)

Remove compare list or return true if user not logged

bool
deleteCompareListSession(Session $session)

Remove all products from compare list in session

array|bool
getCompareListsForUser()

Find all users price list or false if user not logged

getProduct(Product $product)

Find product by id

Product|bool|Proxy|null|object
getProductReference(int $productId)

Get product referece

array|bool|mixed
getAllProductsForCompare(Session $session)

Find all products in compare lists

int
handleCompareProductAddToSession(Session $session, Compare $compareObject)

Add product to compare is session list

bool
handleCompareProductRemoveFromSession(Session|SessionInterface $session, Compare $compareObject)

Remove product from session compare list

array
getAttributesForCompare(array $array)

Find all attributes for compare

array
getFeatures(array $array)

Find all features for compare

dispatchShouldAddProductToCompare()

Dispatch event to check should add product to compare list

Details

at line 40
__construct(CompareRepository $repository, ProductCompareEventContainer $eventContainer)

CompareManager constructor.

Parameters

CompareRepository $repository
ProductCompareEventContainer $eventContainer

at line 52
string translate(String $messageToTranslate)

Translate message

Parameters

String $messageToTranslate

Return Value

string

at line 63
Compare getOneById(int $id)

Find compare list by id

Parameters

int $id

Return Value

Compare

at line 74
Compare save(Compare $compareList)

Create reference to user and persist new compare list

Parameters

Compare $compareList

Return Value

Compare

at line 88
bool deleteCompareList(int $compareListID)

Remove compare list or return true if user not logged

Parameters

int $compareListID

Return Value

bool

at line 104
bool deleteCompareListSession(Session $session)

Remove all products from compare list in session

Parameters

Session $session

Return Value

bool

at line 116
array|bool getCompareListsForUser()

Find all users price list or false if user not logged

Return Value

array|bool

at line 136
Product getProduct(Product $product)

Find product by id

Parameters

Product $product

Return Value

Product

Exceptions

NoResultException
NonUniqueResultException

at line 149
Product|bool|Proxy|null|object getProductReference(int $productId)

Get product referece

Parameters

int $productId

Return Value

Product|bool|Proxy|null|object

Exceptions

ORMException

at line 163
array|bool|mixed getAllProductsForCompare(Session $session)

Find all products in compare lists

Parameters

Session $session

Return Value

array|bool|mixed

Exceptions

NoResultException
NonUniqueResultException

at line 196
int handleCompareProductAddToSession(Session $session, Compare $compareObject)

Add product to compare is session list

Parameters

Session $session
Compare $compareObject

Return Value

int

at line 212
bool handleCompareProductRemoveFromSession(Session|SessionInterface $session, Compare $compareObject)

Remove product from session compare list

Parameters

Session|SessionInterface $session
Compare $compareObject

Return Value

bool

at line 228
array getAttributesForCompare(array $array)

Find all attributes for compare

Parameters

array $array

Return Value

array

Exceptions

DBALException

at line 273
array getFeatures(array $array)

Find all features for compare

Parameters

array $array

Return Value

array

at line 298
EventWithResult dispatchShouldAddProductToCompare()

Dispatch event to check should add product to compare list

Return Value

EventWithResult