class FaqCategoryRepository extends CategoryTranslatableRepository implements AbstractBlockElementRepositoryInterface

Class FaqCategoryRepository is injected as alligator.faq_category_repository service. FaqCategoryRepository is used for crud operation for entity.

Use this class to work with database.

Traits

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

Constants

TRANSLATION_WALKER_HINT

ALIAS

Alias for entity

FAQ_CATEGORY_BLOCKS_RESULT_CACHE

Cache key

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

No description

array
hasRootCategory()

Find root node

array
getAllFaqCategories()

Find all faq categories

array
getAllFaqCategoriesSlugs()

Find slug of all faq categories

saveFaqCategory(FaqCategory $category)

Persist new faq category

array
findOneByIdForEdit(int $id)

Find single faq category for provided id

editFaqCategory(FaqCategory $faqCategory)

Update existing faq category

array
getAllFaqCategoriesForDelete(array $faqCategoriesId)

Find all faq categories that match provided ids

int
deleteFaqCategories(array $items)

No description

editFields(FaqCategory $faqCategory)

Update existing faq category

persistRoot(FaqCategory $category)

Persist root faq category

changePosition(FaqCategory $category, mixed $oldParent)

Change position of node

updateNumberOfItems(FaqCategory $entity)

Update all child elements

updateNumberOfItemsForArray(array $array)

Update all child elements

array
findCategoriesForCatAdd()

Find all faq category id and name

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

Retrieves the nested array or the decorated output.

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 457
protected string getAlias()

Return Value

string

array hasRootCategory()

Find root node

Return Value

array

at line 46
array getAllFaqCategories()

Find all faq categories

Return Value

array

at line 63
array getAllFaqCategoriesSlugs()

Find slug of all faq categories

Return Value

array

at line 78
stdClass saveFaqCategory(FaqCategory $category)

Persist new faq category

Parameters

FaqCategory $category

Return Value

stdClass

at line 120
array findOneByIdForEdit(int $id)

Find single faq category for provided id

Parameters

int $id

Return Value

array

Exceptions

NoResultException
NonUniqueResultException

at line 147
FaqCategory editFaqCategory(FaqCategory $faqCategory)

Update existing faq category

Parameters

FaqCategory $faqCategory

Return Value

FaqCategory

at line 166
array getAllFaqCategoriesForDelete(array $faqCategoriesId)

Find all faq categories that match provided ids

Parameters

array $faqCategoriesId

Return Value

array

at line 186
int deleteFaqCategories(array $items)

Parameters

array $items

Return Value

int 0 on success. 1 on error

Exceptions

ORMException

at line 216
stdClass editFields(FaqCategory $faqCategory)

Update existing faq category

Parameters

FaqCategory $faqCategory

Return Value

stdClass

at line 253
persistRoot(FaqCategory $category)

Persist root faq category

Parameters

FaqCategory $category

at line 266
stdClass changePosition(FaqCategory $category, mixed $oldParent)

Change position of node

Parameters

FaqCategory $category
mixed $oldParent

Return Value

stdClass

at line 307
updateNumberOfItems(FaqCategory $entity)

Update all child elements

Parameters

FaqCategory $entity

Exceptions

ORMException

at line 333
updateNumberOfItemsForArray(array $array)

Update all child elements

Parameters

array $array

Exceptions

ORMException

at line 359
array findCategoriesForCatAdd()

Find all faq category id and name

Return Value

array

at line 376
array|string getCategoryTree(array $options, string|null $locale = null, bool $frontend = false)

Retrieves the nested array or the decorated output.

Parameters

array $options
string|null $locale
bool $frontend

Return Value

array|string

at line 403
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 431
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 449
deleteResultCaches()

delete all cached results