Skip to content

Commit

Permalink
support "additionnalQueryPart" in ArticleTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
paulandrieux committed Sep 15, 2015
1 parent 97d8b06 commit 3b8ba33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Bundle/BlogBundle/Entity/ArticleTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class ArticleTemplate extends BusinessTemplate
*
* @return string
*/
// public function getQuery()
// {
// return sprintf("%s main_item.pattern = %s", $this->query ? $this->query . " AND " : "WHERE ", $this->getId());
// }
public function additionnalQueryPart()
{
return sprintf("%s main_item.pattern = %s", $this->query ? $this->query . " AND " : "WHERE ", $this->getId());
}
}
3 changes: 3 additions & 0 deletions Bundle/QueryBundle/Helper/QueryHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ public function buildWithSubQuery($containerEntity, QueryBuilder $itemsQueryBuil

//get the query of the container entity
$query = $containerEntity->getQuery();
if (method_exists($containerEntity, 'additionnalQueryPart')) {
$query = $containerEntity->additionnalQueryPart();
}
$orderBy = json_decode($containerEntity->getOrderBy(), true);
if ($query !== '' && $query !== null) {

Expand Down

0 comments on commit 3b8ba33

Please sign in to comment.