class StaticPageRepository extends TranslatableRepository implements AbstractBlockElementRepositoryInterface

Class StaticPageRepository is injected as alligator.static_page_repository service. StaticPageRepository is used for crud operation for entity.

Use this class to work with database.

Traits

Trait JQGridTrait

Constants

TRANSLATION_WALKER_HINT

ALIAS

Alias for main entity

STATIC_PAGE_BLOCKS_RESULT_CACHE

Cache key for block elements result

COMMENT_ALIAS

Alias for comment entity

CATEGORY_ALIAS

Alias for category entity

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

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

object
saveStaticPage(StaticPage $staticPage)

Persist new StaticPage

array
findAllCustomForFrontend(int $page, int $offset, null $locale = null)

Get multiple static pages

array
countPostsPagination(null $locale = null)

Get count for visible static pages

array
getAllPagesSlugs()

Get slug for all visible pages

array
countPostsPaginationByCategory(int $id)

Get number of static pages for specified category

array
findAllCustomForFrontendByCategory(int $page, int $offset, int $categoryId)

Get multiple static pages for specified category

object
editStaticPage(StaticPage $staticPage)

Merge Static Page

array
findOneBySlugCustomForSingleBlog(mixed $slug, null $locale = null)

Get single static page for specified slug

array
findThreeByIdCustomForSingleBlog(int $staticPageId)

Get static page tree

findIdBySlug(string $slug)

Get single static page for slug

array
getAllStaticPages(array $ids)

Get all blog posts whith id in specified array

bool
deleteStaticPages(array $entities)

Delete multiple Static Pages

array
getLastNPosts(int $maxResult)

Get latest blog posts

array
getTreeForMegamenuFromDB(string $locale)

Get data for megamenu

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

mixed
getReference(mixed $id, string $class = StaticPage::class)

Get reference for class

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

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

at line 73
object saveStaticPage(StaticPage $staticPage)

Persist new StaticPage

Parameters

StaticPage $staticPage

Return Value

object

Exceptions

ORMException
OptimisticLockException

at line 112
array findAllCustomForFrontend(int $page, int $offset, null $locale = null)

Get multiple static pages

Parameters

int $page
  • page of data
int $offset
  • number of static pages per pege
null $locale
  • locale of static pages

Return Value

array

at line 147
array countPostsPagination(null $locale = null)

Get count for visible static pages

Parameters

null $locale
  • locale of static pages

Return Value

array

at line 164
array getAllPagesSlugs()

Get slug for all visible pages

Return Value

array

at line 179
array countPostsPaginationByCategory(int $id)

Get number of static pages for specified category

Parameters

int $id

Return Value

array

at line 199
array findAllCustomForFrontendByCategory(int $page, int $offset, int $categoryId)

Get multiple static pages for specified category

Parameters

int $page
  • page of data
int $offset
  • number of static pages per page
int $categoryId
  • id of category

Return Value

array

at line 231
object editStaticPage(StaticPage $staticPage)

Merge Static Page

Parameters

StaticPage $staticPage

Return Value

object

at line 270
array findOneBySlugCustomForSingleBlog(mixed $slug, null $locale = null)

Get single static page for specified slug

Parameters

mixed $slug
null $locale

Return Value

array

at line 307
array findThreeByIdCustomForSingleBlog(int $staticPageId)

Get static page tree

Parameters

int $staticPageId

Return Value

array

at line 335
StaticPage findIdBySlug(string $slug)

Get single static page for slug

Parameters

string $slug

Return Value

StaticPage

Exceptions

NoResultException
NonUniqueResultException

at line 352
array getAllStaticPages(array $ids)

Get all blog posts whith id in specified array

Parameters

array $ids

Return Value

array

at line 369
bool deleteStaticPages(array $entities)

Delete multiple Static Pages

Parameters

array $entities

Return Value

bool

at line 391
array getLastNPosts(int $maxResult)

Get latest blog posts

Parameters

int $maxResult

Return Value

array

at line 420
array getTreeForMegamenuFromDB(string $locale)

Get data for megamenu

Parameters

string $locale

Return Value

array

at line 441
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 484
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 506
deleteResultCaches()

Delete all cached results

at line 523
mixed getReference(mixed $id, string $class = StaticPage::class)

Get reference for class

Parameters

mixed $id
string $class

Return Value

mixed

Exceptions

ORMException