class AttributeValueRepository extends EntityRepository implements AbstractBlockElementRepositoryInterface

Class AttributeValueRepository is injected as alligator.attribute_value_repository service. AttributeValueRepository is used for crud operation for entity.

Use this class to work with database.

Traits

Trait JQGridTrait

Constants

ATTRIBUTE_VALUE_BLOCKS_RESULT_CACHE

ALIAS

Alias for entity

ATTRIBUTE_ALIAS

Alias for attribute entity

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(AttributeValue $entity)

Persist new attribute value

edit(AttributeValue $entity)

Update attribute value

findAttributeValueByName(string $name)

Find attribute value by name. Error if there is more value swith same name

AttributeValue|Proxy|null|object
getReference(int $id, string $class = AttributeValue::class)

Retrieve reference for provided class(attribute value by default)

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

Persist multiple attribute values entities

array
getAllAttributeValueErpCodes()

Find id and code of all attribute values

array
findMultipleByErpCode(array $arrayCodes)

Find all attribute values that match provided codes

array
getAllAttributeValuesNameAndId()

Find id and value of all attribute values

array
getEntitiesForBlockElementsExtension(array $ids)

Get entities from database by ids Tis method is used to for block elements extension Make sure you order data by ids - ids is array of elements and it is sorted by priority - so add this to select -> ' FIELD('.self::ALIAS.'.id'.', '.implode(', ', $ids).') AS sort_col'); - and order by this field Also make sure you cache this data -> qb->useQueryCache(true)->useResultCache(true, 3600)

array
getEntityNamesForIds(array $ids)

Get id and name (field must be name so change it in select) of entity Used in event for block element edit Make sure you order data by ids - ids is array of elements and it is sorted by priority - so add this to select -> ' FIELD('.self::ALIAS.'.id'.', '.implode(', ', $ids).') AS sort_col'); - and order by this field

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

Change order for attribute values in attribute

boolean|string
deleteValue(int $id, int $attribute)

Delete attribute value by id, and update priority of all attribute values in attribute

array
findAttributeValueIdsByValues(array $values)

Find id of all attribute values that match provided names

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

at line 52
AttributeValue save(AttributeValue $entity)

Persist new attribute value

Parameters

AttributeValue $entity

Return Value

AttributeValue

at line 71
AttributeValue edit(AttributeValue $entity)

Update attribute value

Parameters

AttributeValue $entity

Return Value

AttributeValue

at line 92
AttributeValue|null findAttributeValueByName(string $name)

Find attribute value by name. Error if there is more value swith same name

Parameters

string $name

Return Value

AttributeValue|null

Exceptions

NonUniqueResultException

at line 111
AttributeValue|Proxy|null|object getReference(int $id, string $class = AttributeValue::class)

Retrieve reference for provided class(attribute value by default)

Parameters

int $id
string $class

Return Value

AttributeValue|Proxy|null|object

Exceptions

ORMException

at line 124
bool|string saveMultiple(array $attributeValues, int $flushNumber = 30)

Persist multiple attribute values entities

Parameters

array $attributeValues
int $flushNumber

Return Value

bool|string

at line 153
array getAllAttributeValueErpCodes()

Find id and code of all attribute values

Return Value

array

at line 168
array findMultipleByErpCode(array $arrayCodes)

Find all attribute values that match provided codes

Parameters

array $arrayCodes Array of attribute value's code

Return Value

array

at line 181
array getAllAttributeValuesNameAndId()

Find id and value of all attribute values

Return Value

array

at line 200
array getEntitiesForBlockElementsExtension(array $ids)

Get entities from database by ids Tis method is used to for block elements extension Make sure you order data by ids - ids is array of elements and it is sorted by priority - so add this to select -> ' FIELD('.self::ALIAS.'.id'.', '.implode(', ', $ids).') AS sort_col'); - and order by this field Also make sure you cache this data -> qb->useQueryCache(true)->useResultCache(true, 3600)

Parameters

array $ids

Return Value

array

at line 230
array getEntityNamesForIds(array $ids)

Get id and name (field must be name so change it in select) of entity Used in event for block element edit Make sure you order data by ids - ids is array of elements and it is sorted by priority - so add this to select -> ' FIELD('.self::ALIAS.'.id'.', '.implode(', ', $ids).') AS sort_col'); - and order by this field

Parameters

array $ids

Return Value

array

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

Change order for attribute values in attribute

Parameters

int $id
int $newIndex
int $attribute

Return Value

bool

at line 294
boolean|string deleteValue(int $id, int $attribute)

Delete attribute value by id, and update priority of all attribute values in attribute

Parameters

int $id
int $attribute

Return Value

boolean|string

at line 329
array findAttributeValueIdsByValues(array $values)

Find id of all attribute values that match provided names

Parameters

array $values

Return Value

array