class SurveyCategoryRepository extends CategoryTranslatableRepository

Class SurveyCategoryRepository is injected as alligator.survey_category_repository service. SurveyCategoryRepository is used for crud operation for managed 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

Survey category alias

PARENT_ALIAS

Parent alias

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

mixed
getSurveyCategoryBySlug(string $slug)

Get survey category by slug

saveSurveyCategory(SurveyCategory $surveyCategory)

Save survey category to database

array
getAllSurveyCategories()

Get all survey categories

array
getAllSurveyCategoriesForDelete(array $surveyCategoriesId)

Get all survey categories for delete

mixed
changePosition(SurveyCategory $category, mixed $oldParent)

Change position of categoy in category tree

object
makeTemporaryObjectForFrontEnd(SurveyCategory $category)

Make temporary survey category object for frontend

updateNumberOfItemsForVisibleItems(SurveyCategory $entity)

Update number of items for visible categories

mixed
editFields(SurveyCategory $category)

Edit fields for survey category

persistRoot(SurveyCategory $category)

No description

int
deleteCats(array $items)

Delete survey categories

array
deleteSurveyCategories(array $surveyCategories)

Delete survey categories

updateWithoutDates(SurveyCategory $surveyCategory)

Update without dates

updateNumberOfItems(SurveyCategory $entity)

Update number of items for survey category

updateNumberOfItemsForArray(mixed $array)

Update number of items for array

array
findCategoriesForCatAdd()

Find categories for cat add

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

Get category tree

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

Return Value

string

array hasRootCategory()

Find root node

Return Value

array

at line 55
mixed getSurveyCategoryBySlug(string $slug)

Get survey category by slug

Parameters

string $slug

Return Value

mixed

Exceptions

NonUniqueResultException

at line 69
SurveyCategory saveSurveyCategory(SurveyCategory $surveyCategory)

Save survey category to database

Parameters

SurveyCategory $surveyCategory

Return Value

SurveyCategory

at line 86
array getAllSurveyCategories()

Get all survey categories

Return Value

array

at line 105
array getAllSurveyCategoriesForDelete(array $surveyCategoriesId)

Get all survey categories for delete

Parameters

array $surveyCategoriesId

Return Value

array

at line 127
mixed changePosition(SurveyCategory $category, mixed $oldParent)

Change position of categoy in category tree

Parameters

SurveyCategory $category
mixed $oldParent

Return Value

mixed

at line 169
object makeTemporaryObjectForFrontEnd(SurveyCategory $category)

Make temporary survey category object for frontend

Parameters

SurveyCategory $category

Return Value

object

at line 189
updateNumberOfItemsForVisibleItems(SurveyCategory $entity)

Update number of items for visible categories

Parameters

SurveyCategory $entity

Exceptions

ORMException

at line 213
mixed editFields(SurveyCategory $category)

Edit fields for survey category

Parameters

SurveyCategory $category

Return Value

mixed

at line 254
persistRoot(SurveyCategory $category)

Parameters

SurveyCategory $category

at line 268
int deleteCats(array $items)

Delete survey categories

Parameters

array $items

Return Value

int

Exceptions

ORMException

at line 298
array deleteSurveyCategories(array $surveyCategories)

Delete survey categories

Parameters

array $surveyCategories

Return Value

array

at line 316
updateWithoutDates(SurveyCategory $surveyCategory)

Update without dates

Parameters

SurveyCategory $surveyCategory

at line 345
updateNumberOfItems(SurveyCategory $entity)

Update number of items for survey category

Parameters

SurveyCategory $entity

Exceptions

ORMException

at line 369
updateNumberOfItemsForArray(mixed $array)

Update number of items for array

Parameters

mixed $array

Exceptions

Exception

at line 395
array findCategoriesForCatAdd()

Find categories for cat add

Return Value

array

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

Get category tree

Parameters

mixed $options
string $locale
boolean $frontend

Return Value

array|string