class AlbumsRepository extends EntityRepository implements AbstractBlockElementRepositoryInterface

Class AlbumsRepository is injected as empire_albums_plugin.albums_repository service. AlbumsRepository is used for crud operation for managed entity.

Use this class to work with database.

Traits

Trait JQGridTrait

Constants

ALBUMS_BLOCK_RESULT_CACHE

Album block cache key

ALIAS

Album alias

AGGREGATION_ALIAS

Album image aggregation alias

IMAGE_ALIAS

Image alias

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

array
getAlbumsFromDB(null $page = null, null $offset = null, bool $isCount = false)

Get albums from database for requested page and offset, is count parameter is present than return the number of items if not return array result

ArrayCollection
findOneItemForEdit(int $id)

Return Album object by id for editing

mixed
saveItem(Album $item)

Save Album object to database

object
editItem(Album $album)

Edit album object and persist to database

mixed
deleteAlbum(int $id)

Delete album by id

ArrayCollection
getAllItemsForDelete(array $itemsIds)

Get ArrayCollection of Album objects for array of ids

array
findAlbumForFrontend(String $slug)

Get single Album object for frontend by slug

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

deleteResultCaches()

Delete all cached results

bool
changeOrder(int $id, int $newIndex)

Reorder Album by id and set to position of newIndex

int
getAlbumsCount()

Get total number of albums in database

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 60
array getAlbumsFromDB(null $page = null, null $offset = null, bool $isCount = false)

Get albums from database for requested page and offset, is count parameter is present than return the number of items if not return array result

Parameters

null $page
null $offset
bool $isCount

Return Value

array

Exceptions

NoResultException
NonUniqueResultException

at line 97
ArrayCollection findOneItemForEdit(int $id)

Return Album object by id for editing

Parameters

int $id

Return Value

ArrayCollection

at line 116
mixed saveItem(Album $item)

Save Album object to database

Parameters

Album $item

Return Value

mixed

at line 157
object editItem(Album $album)

Edit album object and persist to database

Parameters

Album $album

Return Value

object

at line 198
mixed deleteAlbum(int $id)

Delete album by id

Parameters

int $id

Return Value

mixed

at line 233
ArrayCollection getAllItemsForDelete(array $itemsIds)

Get ArrayCollection of Album objects for array of ids

Parameters

array $itemsIds

Return Value

ArrayCollection

at line 254
array findAlbumForFrontend(String $slug)

Get single Album object for frontend by slug

Parameters

String $slug

Return Value

array

at line 283
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 324
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 346
deleteResultCaches()

Delete all cached results

at line 361
bool changeOrder(int $id, int $newIndex)

Reorder Album by id and set to position of newIndex

Parameters

int $id
int $newIndex

Return Value

bool

Exceptions

DBALException
NonUniqueResultException

at line 396
int getAlbumsCount()

Get total number of albums in database

Return Value

int

Exceptions

NonUniqueResultException