AlbumsRepository
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
Constants
| ALBUMS_BLOCK_RESULT_CACHE |
Album block cache key |
| ALIAS |
Album alias |
| AGGREGATION_ALIAS |
Album image aggregation alias |
| IMAGE_ALIAS |
Image alias |
Methods
Should contain group by which jqgrid uses.
JQGrid function
JQGrid function
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
Return Album object by id for editing
Delete album by id
Get ArrayCollection of Album objects for array of ids
Get single Album object for frontend by slug
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)
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
Delete all cached results
Reorder Album by id and set to position of newIndex
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
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
in JQGridTrait at line 61
array
findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams, JQGridWrapper $jqGridWrapper)
JQGrid function
in JQGridTrait at line 94
array
searchForJQGRID(array $searchParams, array $sortParams, bool $isCountSearch = false, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)
JQGrid function
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
at line 97
ArrayCollection
findOneItemForEdit(int $id)
Return Album object by id for editing
at line 116
mixed
saveItem(Album $item)
Save Album object to database
at line 157
object
editItem(Album $album)
Edit album object and persist to database
at line 198
mixed
deleteAlbum(int $id)
Delete album by id
at line 233
ArrayCollection
getAllItemsForDelete(array $itemsIds)
Get ArrayCollection of Album objects for array of ids
at line 254
array
findAlbumForFrontend(String $slug)
Get single Album object for frontend by slug
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)
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
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
at line 396
int
getAlbumsCount()
Get total number of albums in database