class StaticPageCategoryRepository extends CategoryTranslatableRepository implements AbstractBlockElementRepositoryInterface

Class StaticPageCategoryRepository is injected as alligator.static_page_category_repository service. StaticPageCategoryRepository is used for crud operation for entity.

Use this class to work with database.

Traits

Trait JQGridTrait
Trait EmpireNestedTreeRepositoryTrait contains methods for work with tree structure. Should be included in repository that extends NestedTreeRepository

Constants

TRANSLATION_WALKER_HINT

ALIAS

Alias for main entity

POSTS_ALIAS

Alias

STATIC_CATEGORY_BLOCKS_RESULT_CACHE

Key for caching static page category blocks

Properties

protected string $defaultLocale from CategoryTranslatableRepository

Methods

setDefaultLocale(string $locale)

Sets default locale

QueryBuilder
getOneOrNullResult(QueryBuilder $qb, string $locale = null, string $hydrationMode = null)

Returns translated one (or null if not found) result for given locale

QueryBuilder
getResult(QueryBuilder $qb, string $locale = null, int $hydrationMode = AbstractQuery::HYDRATE_OBJECT)

Returns translated results for given locale

mixed
getArrayResult(QueryBuilder $qb, string $locale = null)

Returns translated array results for given locale

QueryBuilder
getSingleResult(QueryBuilder $qb, string $locale = null, string $hydrationMode = null)

Returns translated single result for given locale

array
getScalarResult(QueryBuilder $qb, string $locale = null)

Returns translated scalar result for given locale

QueryBuilder
getSingleScalarResult(QueryBuilder $qb, string $locale = null)

Returns translated single scalar result for given locale

save(PrimaryKeyInterface $entity)

Persist new entity to database

remove(mixed $entity)

Remove entity from database

QueryBuilder
getAll()

Find all entities ordered by id descending

QueryBuilder
getByPrimaryKey(PrimaryKeyInterface $entity, mixed $param = null)

Find entity by primary key

mixed
getById(int $id)

Find entity by id

QueryBuilder|array
getGroupFromDB(mixed $array)

Find entities for provided array of entities

EntityManager
getManager()

Singleton

mixed
saveCollection(array $array)

Persist array of new entities

Query
getTranslatedQuery(QueryBuilder $qb, string $locale = null)

Returns translated Doctrine query instance

startTransaction()

Begins transaction over database

commitTransaction()

Commit transaction over database

rollbackTransaction()

Rollback transaction over database

string
getAlias()

Get alias for main entity

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
hasRootCategory()

Find root node

object
saveStaticPageCategory(StaticPageCategory $staticPageCategory)

Persist new Static Page Category

array
getAllCategoriesSlugs()

Get array of slugs for all static page categories

object
editFields(StaticPageCategory $staticPageCategory)

Merge Static Page Category

persistRoot(StaticPageCategory $category)

Persist static page category root

object
changePosition(StaticPageCategory $category, mixed $oldParent)

No description

updateNumberOfPostsForVisibleItems(StaticPageCategory $entity)

Update number of visible static pages

updateNumberOfPostsForArrayForVisibleItems(array $array)

Update number of visible static pages for elements in array

findCategoryBySlug(string $slug, string|null $locale = null)

Find Static Page Category by slug

array|string
getCategoryTree(mixed $options, null $locale = null, boolean $frontend = false)

Get tree for Static Page Category

array
getAllStaticPageCategoriesForDelete(array $ids)

Get all static pages by array of ids for delete

bool
deleteStaticPageCategories(array $blogCategories)

Delete Static page categories

array|string
getTreeForMegamenuFromDB()

UnfinishedMethod. You can adjust these method if you want layers with categories in megamenu.

array
getLanguagesForIds(array $ids)

Get distinct languages for specified ids

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)

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

deleteResultCaches()

Delete all cached results

Details

setDefaultLocale(string $locale)

Sets default locale

Parameters

string $locale

QueryBuilder getOneOrNullResult(QueryBuilder $qb, string $locale = null, string $hydrationMode = null)

Returns translated one (or null if not found) result for given locale

Parameters

QueryBuilder $qb A Doctrine query builder instance
string $locale A locale name
string $hydrationMode A Doctrine results hydration mode

Return Value

QueryBuilder

Exceptions

NonUniqueResultException

QueryBuilder getResult(QueryBuilder $qb, string $locale = null, int $hydrationMode = AbstractQuery::HYDRATE_OBJECT)

Returns translated results for given locale

Parameters

QueryBuilder $qb A Doctrine query builder instance
string $locale A locale name
int $hydrationMode A Doctrine results hydration mode

Return Value

QueryBuilder

mixed getArrayResult(QueryBuilder $qb, string $locale = null)

Returns translated array results for given locale

Parameters

QueryBuilder $qb A Doctrine query builder instance
string $locale A locale name

Return Value

mixed

QueryBuilder getSingleResult(QueryBuilder $qb, string $locale = null, string $hydrationMode = null)

Returns translated single result for given locale

Parameters

QueryBuilder $qb A Doctrine query builder instance
string $locale A locale name
string $hydrationMode A Doctrine results hydration mode

Return Value

QueryBuilder

Exceptions

NoResultException
NonUniqueResultException

array getScalarResult(QueryBuilder $qb, string $locale = null)

Returns translated scalar result for given locale

Parameters

QueryBuilder $qb A Doctrine query builder instance
string $locale A locale name

Return Value

array

QueryBuilder getSingleScalarResult(QueryBuilder $qb, string $locale = null)

Returns translated single scalar result for given locale

Parameters

QueryBuilder $qb A Doctrine query builder instance
string $locale A locale name

Return Value

QueryBuilder

Exceptions

NonUniqueResultException

PrimaryKeyInterface save(PrimaryKeyInterface $entity)

Persist new entity to database

Parameters

PrimaryKeyInterface $entity

Return Value

PrimaryKeyInterface

Exceptions

Exception

remove(mixed $entity)

Remove entity from database

Parameters

mixed $entity

Exceptions

Exception

PrimaryKeyInterface edit(PrimaryKeyInterface $entity)

Merge entity

Parameters

PrimaryKeyInterface $entity

Return Value

PrimaryKeyInterface

Exceptions

Exception

QueryBuilder getAll()

Find all entities ordered by id descending

Return Value

QueryBuilder

QueryBuilder getByPrimaryKey(PrimaryKeyInterface $entity, mixed $param = null)

Find entity by primary key

Parameters

PrimaryKeyInterface $entity
mixed $param

Return Value

QueryBuilder

Exceptions

NoResultException
NonUniqueResultException

mixed getById(int $id)

Find entity by id

Parameters

int $id

Return Value

mixed

Exceptions

NoResultException
NonUniqueResultException

QueryBuilder|array getGroupFromDB(mixed $array)

Find entities for provided array of entities

Parameters

mixed $array

Return Value

QueryBuilder|array

EntityManager getManager()

Singleton

Return Value

EntityManager

mixed saveCollection(array $array)

Persist array of new entities

Parameters

array $array

Return Value

mixed

Exceptions

Exception

protected Query getTranslatedQuery(QueryBuilder $qb, string $locale = null)

Returns translated Doctrine query instance

Parameters

QueryBuilder $qb A Doctrine query builder instance
string $locale A locale name

Return Value

Query

protected startTransaction()

Begins transaction over database

protected commitTransaction()

Commit transaction over database

protected rollbackTransaction()

Rollback transaction over database

at line 55
string getAlias()

Get alias for main entity

Return Value

string

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

array hasRootCategory()

Find root node

Return Value

array

at line 66
object saveStaticPageCategory(StaticPageCategory $staticPageCategory)

Persist new Static Page Category

Parameters

StaticPageCategory $staticPageCategory

Return Value

object

at line 99
array getAllCategoriesSlugs()

Get array of slugs for all static page categories

Return Value

array

at line 112
object editFields(StaticPageCategory $staticPageCategory)

Merge Static Page Category

Parameters

StaticPageCategory $staticPageCategory

Return Value

object

at line 156
persistRoot(StaticPageCategory $category)

Persist static page category root

Parameters

StaticPageCategory $category

at line 167
object changePosition(StaticPageCategory $category, mixed $oldParent)

Parameters

StaticPageCategory $category
mixed $oldParent

Return Value

object

at line 208
updateNumberOfPostsForVisibleItems(StaticPageCategory $entity)

Update number of visible static pages

Parameters

StaticPageCategory $entity

Exceptions

ORMException

at line 234
updateNumberOfPostsForArrayForVisibleItems(array $array)

Update number of visible static pages for elements in array

Parameters

array $array

Exceptions

ORMException

at line 268
StaticPageCategory findCategoryBySlug(string $slug, string|null $locale = null)

Find Static Page Category by slug

Parameters

string $slug
string|null $locale

Return Value

StaticPageCategory

Exceptions

NoResultException
NonUniqueResultException

at line 291
array|string getCategoryTree(mixed $options, null $locale = null, boolean $frontend = false)

Get tree for Static Page Category

Parameters

mixed $options
null $locale
boolean $frontend

Return Value

array|string

at line 323
array getAllStaticPageCategoriesForDelete(array $ids)

Get all static pages by array of ids for delete

Parameters

array $ids

Return Value

array

at line 338
bool deleteStaticPageCategories(array $blogCategories)

Delete Static page categories

Parameters

array $blogCategories

Return Value

bool FALSE on error, TRUE otherwise

at line 368
array|string getTreeForMegamenuFromDB()

UnfinishedMethod. You can adjust these method if you want layers with categories in megamenu.

Return Value

array|string

at line 427
array getLanguagesForIds(array $ids)

Get distinct languages for specified ids

Parameters

array $ids

Return Value

array

at line 439
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)

Parameters

array $ids

Return Value

array

at line 458
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

Parameters

array $ids

Return Value

array

at line 472
deleteResultCaches()

Delete all cached results