class AnswerRepository extends TranslatableRepository

Class AnswerRepository is injected as alligator.answer_repository service. AnswerRepository is used for crud operation for managed entity.

Use this class to work with database.

Constants

TRANSLATION_WALKER_HINT

Properties

protected string $defaultLocale from TranslatableRepository

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

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

Returns translated results for given locale

array
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

remove(mixed $entity)

Remove entity

bool
removeArray(array $arrayOfEntities)

Remove entities provided as array

edit(PrimaryKeyInterface $entity)

Sets default locale to entity and merge

mixed
getAll()

Find all entities depending on locale

mixed
getByPrimaryKey(PrimaryKeyInterface $entity)

Find entity by primary key

QueryBuilder
getById(int $id)

Find entity by id

QueryBuilder|array
getGroupFromDB(array $array)

Find group od entities

EntityManager
getManager()

Singleton

mixed
saveCollection(array $array)

Persist collection

array
getLanguagesForIds(array $ids)

Find all locales for custom ids of 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

saveAnswer(Answer $answer)

Save answer object

saveAnswers(array $answers)

Save multiple answers

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

mixed 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

mixed

array 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

array

in TranslatableRepository at line 102
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

in TranslatableRepository at line 115
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

in TranslatableRepository at line 130
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

in TranslatableRepository at line 142
PrimaryKeyInterface save(PrimaryKeyInterface $entity)

Parameters

PrimaryKeyInterface $entity

Return Value

PrimaryKeyInterface

Exceptions

Exception

in TranslatableRepository at line 172
remove(mixed $entity)

Remove entity

Parameters

mixed $entity

Exceptions

Exception

in TranslatableRepository at line 200
bool removeArray(array $arrayOfEntities)

Remove entities provided as array

Parameters

array $arrayOfEntities

Return Value

bool

Exceptions

Exception

in TranslatableRepository at line 228
PrimaryKeyInterface edit(PrimaryKeyInterface $entity)

Sets default locale to entity and merge

Parameters

PrimaryKeyInterface $entity

Return Value

PrimaryKeyInterface

Exceptions

Exception

in TranslatableRepository at line 253
mixed getAll()

Find all entities depending on locale

Return Value

mixed

in TranslatableRepository at line 270
mixed getByPrimaryKey(PrimaryKeyInterface $entity)

Find entity by primary key

Parameters

PrimaryKeyInterface $entity

Return Value

mixed

Exceptions

NoResultException
NonUniqueResultException

in TranslatableRepository at line 291
QueryBuilder getById(int $id)

Find entity by id

Parameters

int $id

Return Value

QueryBuilder

Exceptions

NoResultException
NonUniqueResultException

in TranslatableRepository at line 307
QueryBuilder|array getGroupFromDB(array $array)

Find group od entities

Parameters

array $array Objects

Return Value

QueryBuilder|array

in TranslatableRepository at line 332
EntityManager getManager()

Singleton

Return Value

EntityManager

in TranslatableRepository at line 352
mixed saveCollection(array $array)

Persist collection

Parameters

array $array

Return Value

mixed

Exceptions

Exception

in TranslatableRepository at line 379
array getLanguagesForIds(array $ids)

Find all locales for custom ids of entities

Parameters

array $ids

Return Value

array

in TranslatableRepository at line 396
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

in TranslatableRepository at line 404
protected startTransaction()

Begins transaction over database

in TranslatableRepository at line 412
protected commitTransaction()

Commit transaction over database

in TranslatableRepository at line 420
protected rollbackTransaction()

Rollback transaction over database

at line 27
string getAlias()

Return Value

string

at line 39
Answer saveAnswer(Answer $answer)

Save answer object

Parameters

Answer $answer

Return Value

Answer

at line 58
Answer saveAnswers(array $answers)

Save multiple answers

Parameters

array $answers

Return Value

Answer