class AttributeManager implements BasicEntityManagerInterface, CSVManagerInterface, JQGridInterface

Class AttributeManager is injected as alligator.attribute_manager service. AttributeManager handles the logic for managed entity.

Traits

Trait JQGridManagerTrait

Properties

protected AttributeRepository $repository

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(AttributeRepository $repository, AttributeEventContainer $eventContainer)

AttributeManager constructor.

saveAttribute(Attribute $attribute)

Save new attribute

mixed
saveMultipleWithoutValues(array $attributes, int $batch = 100)

Save multiple attributes

array
findAllAttributes()

Find all attributes sorted by id in descending order

array
findAllAttributesWithAttributeValues()

Find all attributes(with attribute values)

array
findAttributeByIdWithAttributeValues(int $id)

Find attribute(with attribute values) for provided id

array
getAllAttributesWithAttributeValueArray()

Find all attributes(with attribute values) as ARRAY

array
getAttributesFieldsFromMetadata()

Retrieve fields for attribute class

editAttribute(Attribute $attribute)

Update attribute entity

mergeAttribute(Attribute $dbAttribute)

Update attribute entity

array
importFromCSVWithFileName(String $base64, String $locale, String $fileName)

We want to save name of category/attribute_set first, then we will call method importFromCsv

mixed
importFromCSV(mixed $base64Content, mixed $locale)

Converts to appropriate entities and persists to database

getEntityObject()

Retrieve new attribute entity

mixed|void
exportToCSV()

Get entities data and export to CSV file

mixed|void
exportCustom(array $data)

Export attribute to csv

mixed
saveObjectsFromCSV(ArrayCollection $objectList, array $csvRow, array $entityCSVHeaders, array $propertyMappings = array())

Persist entities to database

mixed
getCustomAttributeFieldsForExport(array $fields)

Retrieve attributes with custom fields

bool
deleteAttribute(array $array)

Remove attributes that match provided ids and dispatch event to remove translations

array
findAttributes(array $array)

Find all attributes that match provided ids

Attribute|object|null
findAttributeByName(string $code)

Finds a single attribute by a set of criteria.

findAttribute(Attribute $attribute)

Find attribute that match provided id

dispatchGenerateAttrTranslationSignal(Attribute $attribute)

Dispatch event to generate translations for entity

dispatchAttributeChange(int $id)

Signal event to update search options on product

dispatchProductGroupUpdate(array $attrIds)

Dispatch event to re-cache product groups

array
getAllAttributeErpCodes()

Find id and code of all attributes(used in synchronization with erp)

bool|Proxy|null|object
getReference(int $id)

Retrieve reference for Attribute

bool
changeOrder(int $id, int $newIndex, int $attribute)

Change priority of attribute entity

bool|string
setMissingPriorities()

Update priority for attributes

array
findAllWithValues()

Find all attributes(with attribute values)

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 55
__construct(AttributeRepository $repository, AttributeEventContainer $eventContainer)

AttributeManager constructor.

Parameters

AttributeRepository $repository
AttributeEventContainer $eventContainer

at line 68
Attribute saveAttribute(Attribute $attribute)

Save new attribute

Parameters

Attribute $attribute

Return Value

Attribute

at line 91
mixed saveMultipleWithoutValues(array $attributes, int $batch = 100)

Save multiple attributes

Parameters

array $attributes
int $batch

Return Value

mixed

at line 101
array findAllAttributes()

Find all attributes sorted by id in descending order

Return Value

array

at line 111
array findAllAttributesWithAttributeValues()

Find all attributes(with attribute values)

Return Value

array

at line 126
array findAttributeByIdWithAttributeValues(int $id)

Find attribute(with attribute values) for provided id

Parameters

int $id

Return Value

array

Exceptions

NoResultException
NonUniqueResultException

at line 136
array getAllAttributesWithAttributeValueArray()

Find all attributes(with attribute values) as ARRAY

Return Value

array

at line 146
array getAttributesFieldsFromMetadata()

Retrieve fields for attribute class

Return Value

array

at line 161
Attribute editAttribute(Attribute $attribute)

Update attribute entity

Parameters

Attribute $attribute

Return Value

Attribute

Exceptions

NoResultException
NonUniqueResultException

at line 179
Attribute mergeAttribute(Attribute $dbAttribute)

Update attribute entity

Parameters

Attribute $dbAttribute

Return Value

Attribute

at line 193
array importFromCSVWithFileName(String $base64, String $locale, String $fileName)

We want to save name of category/attribute_set first, then we will call method importFromCsv

Parameters

String $base64
String $locale
String $fileName

Return Value

array

at line 203
mixed importFromCSV(mixed $base64Content, mixed $locale)

Converts to appropriate entities and persists to database

Parameters

mixed $base64Content
mixed $locale

Return Value

mixed

at line 213
CSVEntityInterface getEntityObject()

Retrieve new attribute entity

Return Value

CSVEntityInterface

at line 221
mixed|void exportToCSV()

Get entities data and export to CSV file

Return Value

mixed|void

at line 233
mixed|void exportCustom(array $data)

Export attribute to csv

Parameters

array $data

Return Value

mixed|void

at line 241
mixed saveObjectsFromCSV(ArrayCollection $objectList, array $csvRow, array $entityCSVHeaders, array $propertyMappings = array())

Persist entities to database

Parameters

ArrayCollection $objectList
array $csvRow
array $entityCSVHeaders
array $propertyMappings

Return Value

mixed

at line 333
mixed getCustomAttributeFieldsForExport(array $fields)

Retrieve attributes with custom fields

Parameters

array $fields

Return Value

mixed

at line 360
bool deleteAttribute(array $array)

Remove attributes that match provided ids and dispatch event to remove translations

Parameters

array $array

Return Value

bool

at line 387
array findAttributes(array $array)

Find all attributes that match provided ids

Parameters

array $array

Return Value

array

at line 399
Attribute|object|null findAttributeByName(string $code)

Finds a single attribute by a set of criteria.

Parameters

string $code

Return Value

Attribute|object|null

at line 414
Attribute findAttribute(Attribute $attribute)

Find attribute that match provided id

Parameters

Attribute $attribute

Return Value

Attribute

Exceptions

NoResultException
NonUniqueResultException

at line 424
dispatchGenerateAttrTranslationSignal(Attribute $attribute)

Dispatch event to generate translations for entity

Parameters

Attribute $attribute

at line 434
dispatchAttributeChange(int $id)

Signal event to update search options on product

Parameters

int $id

at line 444
dispatchProductGroupUpdate(array $attrIds)

Dispatch event to re-cache product groups

Parameters

array $attrIds

at line 454
array getAllAttributeErpCodes()

Find id and code of all attributes(used in synchronization with erp)

Return Value

array

at line 468
bool|Proxy|null|object getReference(int $id)

Retrieve reference for Attribute

Parameters

int $id

Return Value

bool|Proxy|null|object

Exceptions

ORMException

at line 482
bool changeOrder(int $id, int $newIndex, int $attribute)

Change priority of attribute entity

Parameters

int $id
int $newIndex
int $attribute

Return Value

bool

at line 492
bool|string setMissingPriorities()

Update priority for attributes

Return Value

bool|string

at line 502
array findAllWithValues()

Find all attributes(with attribute values)

Return Value

array