DeclarationCategoryRepository
class DeclarationCategoryRepository extends CategoryTranslatableRepository implements AbstractBlockElementRepositoryInterface
Class DeclarationCategoryRepository is injected as empire_declaration_plugin.declaration_category_repository service. DeclarationCategoryRepository is used for crud operation for entity.
Use this class to work with database.
Traits
Constants
| TRANSLATION_WALKER_HINT |
|
| DECLARATION_CATEGORY_BLOCKS_RESULT_CACHE |
Define key for caching declarations for block elements |
| ALIAS |
Alias for entity |
Properties
| protected string | $defaultLocale | from CategoryTranslatableRepository |
Methods
Returns translated one (or null if not found) result for given locale
Returns translated results for given locale
Returns translated array results for given locale
Returns translated single result for given locale
Returns translated scalar result for given locale
Returns translated single scalar result for given locale
Find all entities ordered by id descending
Find entities for provided array of entities
Persist array of new entities
Returns translated Doctrine query instance
No description
Should contain group by which jqgrid uses.
JQGrid function
JQGrid function
No description
No description
Find all categories(as array)
Change position of category
Query for visible declarations/children nodes and update corresponding fields on category
Update number of visible child nodes for provided category
Find all categories that match provided ids
Function that returns ids of all images that categories 'children' contains
if you want not to delete subcategories use $this->removeFromTree($cat); method
Update number of visible child nodes for category that match provided ids
Generate html for frontend
Generate html for frontend
Find language locale for category that match provided id. NULL on missing category
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('.$this->getAlias().'.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('.$this->getAlias().'.id'.', '.implode(', ', $ids).') AS sort_col'); - and order by this field
delete all cached results
Details
in CategoryTranslatableRepository at line 41
setDefaultLocale(string $locale)
Sets default locale
in CategoryTranslatableRepository at line 57
QueryBuilder
getOneOrNullResult(QueryBuilder $qb, string $locale = null, string $hydrationMode = null)
Returns translated one (or null if not found) result for given locale
in CategoryTranslatableRepository at line 71
QueryBuilder
getResult(QueryBuilder $qb, string $locale = null, int $hydrationMode = AbstractQuery::HYDRATE_OBJECT)
Returns translated results for given locale
in CategoryTranslatableRepository at line 84
mixed
getArrayResult(QueryBuilder $qb, string $locale = null)
Returns translated array results for given locale
in CategoryTranslatableRepository at line 101
QueryBuilder
getSingleResult(QueryBuilder $qb, string $locale = null, string $hydrationMode = null)
Returns translated single result for given locale
in CategoryTranslatableRepository at line 114
array
getScalarResult(QueryBuilder $qb, string $locale = null)
Returns translated scalar result for given locale
in CategoryTranslatableRepository at line 129
QueryBuilder
getSingleScalarResult(QueryBuilder $qb, string $locale = null)
Returns translated single scalar result for given locale
in CategoryTranslatableRepository at line 142
PrimaryKeyInterface
save(PrimaryKeyInterface $entity)
Persist new entity to database
in CategoryTranslatableRepository at line 171
remove(mixed $entity)
Remove entity from database
in CategoryTranslatableRepository at line 197
PrimaryKeyInterface
edit(PrimaryKeyInterface $entity)
Merge entity
in CategoryTranslatableRepository at line 220
QueryBuilder
getAll()
Find all entities ordered by id descending
in CategoryTranslatableRepository at line 237
QueryBuilder
getByPrimaryKey(PrimaryKeyInterface $entity, mixed $param = null)
Find entity by primary key
in CategoryTranslatableRepository at line 255
mixed
getById(int $id)
Find entity by id
in CategoryTranslatableRepository at line 270
QueryBuilder|array
getGroupFromDB(mixed $array)
Find entities for provided array of entities
in CategoryTranslatableRepository at line 295
EntityManager
getManager()
Singleton
in CategoryTranslatableRepository at line 314
mixed
saveCollection(array $array)
Persist array of new entities
in CategoryTranslatableRepository at line 341
protected Query
getTranslatedQuery(QueryBuilder $qb, string $locale = null)
Returns translated Doctrine query instance
in CategoryTranslatableRepository at line 349
protected
startTransaction()
Begins transaction over database
in CategoryTranslatableRepository at line 357
protected
commitTransaction()
Commit transaction over database
in CategoryTranslatableRepository at line 365
protected
rollbackTransaction()
Rollback transaction over database
at line 49
string
getAlias()
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
in EmpireNestedTreeRepositoryTrait at line 23
array
hasRootCategory()
Find root node
at line 57
string
getParentAlias()
at line 65
string
getItemAlias()
at line 75
array
getAllCategories()
Find all categories(as array)
at line 91
stdClass
editFields(DeclarationCategory $category)
Updating existed Declaration category
at line 133
object
changePosition(DeclarationCategory $category, null|DeclarationCategory $oldParent)
Change position of category
at line 177
updateNumberOfItemsForVisibleItems(DeclarationCategory $entity)
Query for visible declarations/children nodes and update corresponding fields on category
at line 212
DeclarationCategory
saveEntity(DeclarationCategory $category)
Persist new entity
at line 229
object
saveTreeCategory(DeclarationCategory $category)
Persist new declaration category
at line 269
DeclarationCategory
updateNumberOfKids(DeclarationCategory $entity)
Update number of visible child nodes for provided category
at line 302
array
getAllTreeCategoriesForDelete(array $ids)
Find all categories that match provided ids
at line 321
array
getImagesIdsForDelete(array $categoryId)
Function that returns ids of all images that categories 'children' contains
at line 342
int
deleteTreeCategories(array $objects)
if you want not to delete subcategories use $this->removeFromTree($cat); method
at line 374
updateNumberOfItemsForArrayForVisibleItems(mixed $array)
Update number of visible child nodes for category that match provided ids
at line 412
array|string
getCatsForMainFrontEnd(array|null $options = null, string|null $locale = null)
Generate html for frontend
at line 508
array|string
getCategoryTree(array $options, string|null $locale = null)
Generate html for frontend
at line 526
string|null
getLanguageForId(int $id)
Find language locale for category that match provided id. NULL on missing category
at line 547
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('.$this->getAlias().'.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 575
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('.$this->getAlias().'.id'.', '.implode(', ', $ids).') AS sort_col'); - and order by this field
at line 593
deleteResultCaches()
delete all cached results