* Startseite

* Sidebar-Widgets: Reisemagazin, Reiseführer, Angebote

git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3301 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
uli 2017-02-21 20:09:46 +00:00
parent 353b758bcd
commit 4278e110fc
12 changed files with 305 additions and 381 deletions

View file

@ -1,7 +1,9 @@
<?php
namespace AppBundle\Entity;
use Gedmo\Tree\Entity\Repository\NestedTreeRepository;
use Doctrine\ORM\Query\Expr;
/**
* PageRepository
@ -41,6 +43,73 @@ class PageRepository extends NestedTreeRepository
return $pages;
}
public function findWithTravelProgramsOfCountry(TravelCountry $country)
{
return $this->createQueryBuilder('node')
->innerJoin('node.travelProgram', 'tp')
->innerJoin('tp.countries', 'c')
->where('c.id = '. $country->getId())
->getQuery()
->execute()
;
}
/**
* @return Page[]
*/
public function findOffers()
{
$ret = [];
$countries = $this->getEntityManager()->getRepository('AppBundle:TravelCountry')->findAll();
foreach ($countries as $country)
{
$ret = array_merge($ret, $this->createQueryBuilder('node')
->innerJoin('node.travelProgram', 'tp')
->addSelect('tp')
->innerJoin('tp.countries', 'c')
->where('c.id = '. $country->getId())
->andWhere('node.status > 0')
->andWhere('tp.status > 0')
->orderBy('node.order')
->addOrderBy('tp.position')
->addOrderBy('node.title')
->setMaxResults(3)
->getQuery()
->execute()
);
}
shuffle($ret);
return $ret;
}
public function findCountryPages()
{
return $this->createQueryBuilder('node')
->innerJoin('node.country', 'country')
->where('node.status > 0')
->andWhere('node.template = \'overview\'')
->andWhere('node.lvl = 0')
->orderBy('node.lft,node.title')
->getQuery()
->execute()
;
}
public function findTopCountryNavPages()
{
return $this->createQueryBuilder('node')
->innerJoin('node.country', 'country')
->leftJoin('node.children', 'childPage', Expr\Join::WITH, 'childPage.status > 0')
->addSelect('childPage')
->where('node.status > 0')
->andWhere('node.template = \'overview\'')
->andWhere('node.lvl = 0')
->orderBy('node.lft,node.title,childPage.lft,childPage.title')
->getQuery()
->execute()
;
}
/**
* @param Page $page
*