BlogPostRepository
class BlogPostRepository extends TranslatableRepository implements AbstractBlockElementRepositoryInterface
Class BlogPostRepository is injected as alligator.blog_post_repository service. BlogPostRepository is used for crud operation for managed entity.
Use this class to work with database.
Traits
Constants
| TRANSLATION_WALKER_HINT |
|
| ALIAS |
Alias for blog post |
| CATEGORY_ALIAS |
Alias for blog post category entity |
| BLOG_POST_BLOCKS_RESULT_CACHE |
Key for caching blog post blocks |
Properties
| protected string | $defaultLocale | from TranslatableRepository |
Methods
Returns translated one (or null if not found) result for given locale
Returns translated results for given locale
Returns translated array results for given locale
Returns translated single result for given locale
Returns translated scalar result for given locale
Returns translated single scalar result for given locale
Remove entities provided as array
Find all locales for custom ids of entities
Returns translated Doctrine query instance
Alias for blog post
Should contain group by which jqgrid uses.
JQGrid function
JQGrid function
Alias for current blog post parent
Alias for image
Alias for blog comment
Alias for blog category
Return table name of blog post entity
Find all blog posts using pagination
Count all visible blog posts
Count all visible blog posts for blog category
Find all blog post for blog category using pagination
Find blog post by slug
Find previous and next blog posts
Find blog posts for provided ids
Find all blog posts for provided array of ids
Remove blog post from array
Find $maxResult number of last blog posts
Find all blog post slugs
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)
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
Delete all cached results
Find all blog posts for provided blog category parent id
Find all blog posts
Details
in TranslatableRepository at line 41
setDefaultLocale(string $locale)
Sets default locale
in TranslatableRepository 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
in TranslatableRepository at line 72
mixed
getResult(QueryBuilder $qb, string $locale = null, int $hydrationMode = AbstractQuery::HYDRATE_OBJECT)
Returns translated results for given locale
in TranslatableRepository at line 85
array
getArrayResult(QueryBuilder $qb, string $locale = null)
Returns translated array results for given locale
in TranslatableRepository at line 102
QueryBuilder
getSingleResult(QueryBuilder $qb, string $locale = null, string $hydrationMode = null)
Returns translated single result for given locale
in TranslatableRepository at line 115
array
getScalarResult(QueryBuilder $qb, string $locale = null)
Returns translated scalar result for given locale
in TranslatableRepository at line 130
QueryBuilder
getSingleScalarResult(QueryBuilder $qb, string $locale = null)
Returns translated single scalar result for given locale
in TranslatableRepository at line 142
PrimaryKeyInterface
save(PrimaryKeyInterface $entity)
in TranslatableRepository at line 172
remove(mixed $entity)
Remove entity
in TranslatableRepository at line 200
bool
removeArray(array $arrayOfEntities)
Remove entities provided as array
in TranslatableRepository at line 228
PrimaryKeyInterface
edit(PrimaryKeyInterface $entity)
Sets default locale to entity and merge
in TranslatableRepository at line 253
mixed
getAll()
Find all entities depending on locale
in TranslatableRepository at line 270
mixed
getByPrimaryKey(PrimaryKeyInterface $entity)
Find entity by primary key
in TranslatableRepository at line 291
QueryBuilder
getById(int $id)
Find entity by id
in TranslatableRepository at line 307
QueryBuilder|array
getGroupFromDB(array $array)
Find group od entities
in TranslatableRepository at line 332
EntityManager
getManager()
Singleton
in TranslatableRepository at line 352
mixed
saveCollection(array $array)
Persist collection
in TranslatableRepository at line 379
array
getLanguagesForIds(array $ids)
Find all locales for custom ids of entities
in TranslatableRepository at line 396
protected Query
getTranslatedQuery(QueryBuilder $qb, string $locale = null)
Returns translated Doctrine query instance
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 62
string
getAlias()
Alias for blog post
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
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
in JQGridTrait at line 61
array
findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams, JQGridWrapper $jqGridWrapper)
JQGrid function
in JQGridTrait at line 94
array
searchForJQGRID(array $searchParams, array $sortParams, bool $isCountSearch = false, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)
JQGrid function
at line 73
string
getParentAlias()
Alias for current blog post parent
at line 85
string
getImageAlias()
Alias for image
at line 96
string
getCommentAlias()
Alias for blog comment
at line 107
string
getBlogCategoryAlias()
Alias for blog category
at line 118
string
getTableName()
Return table name of blog post entity
at line 129
object
saveBlogPost(BlogPost $blogPost)
Persist new blog post
at line 151
array
findAllCustomForFrontend(int $page, int $offset)
Find all blog posts using pagination
at line 187
array
countPostsPagination()
Count all visible blog posts
at line 207
array
countPostsPaginationByCategory(int $id, int|null $lft = null, int|null $rgt = null)
Count all visible blog posts for blog category
at line 240
array
findAllCustomForFrontendByCategory(int $page, int $offset, int $categoryId, int|null $lft = null, int|null $rgt = null)
Find all blog post for blog category using pagination
at line 287
mixed
editBlogPost(BlogPost $blogPost, bool $isNew)
Merge blog post
at line 312
array
findOneBySlugCustomForSingleBlog(mixed $slug, string|null $locale = null)
Find blog post by slug
at line 350
mixed
findThreeByIdCustomForSingleBlog(int $blogPostId, string $locale)
Find previous and next blog posts
at line 377
mixed
findPrevNextCustomForIds(int $prevId, int $nextId)
Find blog posts for provided ids
at line 414
array
getAllBlogPosts(array $blogPostIds)
Find all blog posts for provided array of ids
at line 440
mixed
deleteBlogPosts(array $entities)
Remove blog post from array
at line 461
array
getLastNPosts(int $maxResult, string|null $locale = null)
Find $maxResult number of last blog posts
at line 498
array
getPostsSlugs()
Find all blog post slugs
at line 511
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)
at line 554
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
at line 572
deleteResultCaches()
Delete all cached results
at line 588
array
getIsotopeCategories(int $id, string $locale, object $additionalData)
Find all blog posts for provided blog category parent id
at line 620
array
findAllPosts()
Find all blog posts