abstract class CategoryTranslatableRepository extends NestedTreeRepository

Class CategoryTranslatableRepository should extends every repository whose managed entity has tree structure.

Use this class to work with database.

Constants

TRANSLATION_WALKER_HINT

Properties

protected string $defaultLocale

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

Alias for main entity

Details

at line 41
setDefaultLocale(string $locale)

Sets default locale

Parameters

string $locale

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

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

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

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

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

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

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

at line 142
PrimaryKeyInterface save(PrimaryKeyInterface $entity)

Persist new entity to database

Parameters

PrimaryKeyInterface $entity

Return Value

PrimaryKeyInterface

Exceptions

Exception

at line 171
remove(mixed $entity)

Remove entity from database

Parameters

mixed $entity

Exceptions

Exception

at line 197
PrimaryKeyInterface edit(PrimaryKeyInterface $entity)

Merge entity

Parameters

PrimaryKeyInterface $entity

Return Value

PrimaryKeyInterface

Exceptions

Exception

at line 220
QueryBuilder getAll()

Find all entities ordered by id descending

Return Value

QueryBuilder

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

Find entity by primary key

Parameters

PrimaryKeyInterface $entity
mixed $param

Return Value

QueryBuilder

Exceptions

NoResultException
NonUniqueResultException

at line 255
mixed getById(int $id)

Find entity by id

Parameters

int $id

Return Value

mixed

Exceptions

NoResultException
NonUniqueResultException

at line 270
QueryBuilder|array getGroupFromDB(mixed $array)

Find entities for provided array of entities

Parameters

mixed $array

Return Value

QueryBuilder|array

at line 295
EntityManager getManager()

Singleton

Return Value

EntityManager

at line 314
mixed saveCollection(array $array)

Persist array of new entities

Parameters

array $array

Return Value

mixed

Exceptions

Exception

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

at line 349
protected startTransaction()

Begins transaction over database

at line 357
protected commitTransaction()

Commit transaction over database

at line 365
protected rollbackTransaction()

Rollback transaction over database

at line 374
abstract protected string getAlias()

Alias for main entity

Return Value

string