BlogCategoryRepository
class BlogCategoryRepository extends CategoryTranslatableRepository implements AbstractBlockElementRepositoryInterface
Class BlogCategoryRepository is injected as alligator.blog_category_repository service. BlogCategoryRepository is used for crud operation for managed entity.
Use this class to work with database.
Traits
Constants
| TRANSLATION_WALKER_HINT |
|
| ALIAS |
Alias for BlogCategory |
| JOIN_WITH_POSTS_ALIAS |
Alias for BlogPost |
| IMAGE_ALIAS |
Alias for Image |
| BLOG_CATEGORY_BLOCKS_RESULT_CACHE |
Key for caching BlogCategory blocks |
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
Alias for BlogCategory
Should contain group by which jqgrid uses.
JQGrid function
JQGrid function
Alias for BlogPost
Persist new BlogCategory, returns code 200 if successful edit, otherwise 304
Change position of node and update visibility of child nodes
Update number of visible items, including child nodes, for specific BlogCategory
Update number of visible items, including child nodes, for array of blog category
Find blog category tree structure. If $frontend param is TRUE, root node is not included
Find all BlogCategory for provided array of ids
Function that returns ids of all images that categories 'children' contains
Removes BlogCategory from provided array. If you want not to delete subcategories use $this->removeFromTree($cat); method
Find BlogCategory with related BlogPosts
Find all BlogCategory slugs
Find BlogCategory with related BlogPost for provided array of ids
Find BlogCategory with its children from provided slug
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 67
string
getAlias()
Alias for BlogCategory
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 77
string
getPostAlias()
Alias for BlogPost
at line 88
object
saveBlogCategory(BlogCategory $blogCategory)
Persist new BlogCategory, returns code 200 if successful edit, otherwise 304
at line 114
object
editFields(BlogCategory $blogCategory)
Merge BlogCategory
at line 142
persistRoot(BlogCategory $category)
Persist new BlogCategory as root
at line 154
object
changePosition(BlogCategory $category, BlogCategory|null $oldParent)
Change position of node and update visibility of child nodes
at line 185
updateNumberOfPostsForVisibleItems(BlogCategory $entity)
Update number of visible items, including child nodes, for specific BlogCategory
at line 209
updateNumberOfPostsForArrayForVisibleItems(array $array)
Update number of visible items, including child nodes, for array of blog category
at line 247
array|string
getCategoryTree(array $options, string|null $locale = null, bool $frontend = false)
Find blog category tree structure. If $frontend param is TRUE, root node is not included
at line 281
array
getAllBlogCategoriesForDelete(array $blogCategoriesId)
Find all BlogCategory for provided array of ids
at line 301
array
getImagesIdsForDelete(array $categoryId)
Function that returns ids of all images that categories 'children' contains
at line 321
int
deleteBlogCategories(array $blogCategories)
Removes BlogCategory from provided array. If you want not to delete subcategories use $this->removeFromTree($cat); method
at line 355
mixed
getNewsFromDB(int $itemNumber, string|null $locale = null)
Find BlogCategory with related BlogPosts
at line 381
array
getCategoriesSlugs()
Find all BlogCategory slugs
at line 400
array
getEntitiesForBlockElementsExtension(array $params)
Find BlogCategory with related BlogPost for provided array of ids
at line 427
mixed
findCategoryBySlug(string $slug, string|null $locale = null)
Find BlogCategory with its children from provided slug
at line 452
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 470
deleteResultCaches()
Delete all cached results