* Suchformular auf Startseite funktioniert nun

* Neueste Design-Änderungen aufgenommen
* Sortierung auf Reiseübersichtsseiten
* Fehler bei Suche behoben

git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3285 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
uli 2016-12-19 08:41:15 +00:00
parent 99c6715712
commit 23b2c7a7e8
12 changed files with 217 additions and 119 deletions

View file

@ -20,12 +20,15 @@ class PageRepository extends NestedTreeRepository
public function getChildrenWithTravelProgramsAndDates(Page $page)
{
$pages = $this->getChildrenQueryBuilder($page)
->leftJoin('node.travelProgram', 'tp')
->addSelect('tp')
->andWhere('tp.status > 0')
->andWhere('node.status > 0')
->getQuery()
->execute();
->leftJoin('node.travelProgram', 'tp')
->addSelect('tp')
->andWhere('tp.status > 0')
->andWhere('node.status > 0')
->orderBy('node.order')
->addOrderBy('tp.position')
->addOrderBy('node.title')
->getQuery()
->execute();
/** @var Page $childPage */
foreach ($pages as &$childPage)
{

View file

@ -45,6 +45,11 @@ class TravelCountry
*/
private $feedbackPage;
/**
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\TravelProgram", mappedBy="countries")
*/
private $programs;
/**

View file

@ -230,7 +230,7 @@ final class TravelDate
$lowest = -1;
foreach ($this->getPrices() as $price)
{
if ($price->getPriceType() == 3)
if ($price->getPriceTypeId() == 3)
{
// Use double room if available (#1076)
return /*$price->getEffectiveDiscountPrice() ??*/ $price->getEffectivePrice();

View file

@ -40,7 +40,10 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
$startDate = $now;
}
$startDateStr = $startDate->format('Y-m-d');
$endDateStr = $endDate->format('Y-m-d');
if ($endDate)
{
$endDateStr = $endDate->format('Y-m-d');
}
$qb = $this->getEntityManager()->createQueryBuilder()
->from('AppBundle:TravelProgram', 'tp', 'tp.id')
@ -64,7 +67,7 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
{
$priceTypeKey = 'price_'. $priceType->getId();
$qb->leftJoin('p.prices', $priceTypeKey, Expr\Join::WITH,
$priceTypeKey .'.priceType = '. $priceType->getId(), null, $priceTypeKey .'.priceType');
$priceTypeKey .'.priceType = '. $priceType->getId(), $priceTypeKey .'.priceTypeId');
$qb->addSelect($priceTypeKey);
}
$qb->leftJoin('p.discounts', 'discount');
@ -77,11 +80,14 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
// Destinations
if (!empty($destinationIds) && is_array($destinationIds))
{
$qb->innerJoin('AppBundle:TravelProgramCountry', 'tpc', Expr\Join::WITH,
'tpc.program = tp AND IDENTITY(tpc.country) IN ('. implode(', ', $destinationIds) .')');
//$qb->innerJoin('AppBundle:TravelProgramCountry', 'tpc', Expr\Join::WITH,
// 'tpc.program = tp AND IDENTITY(tpc.country) IN ('. implode(', ', $destinationIds) .')');
$qb->innerJoin('tp.countries', 'tc', Expr\Join::WITH,
'tc.id IN ('. implode(', ', $destinationIds) .')');
if ($combi)
{
$qb->having('COUNT(DISTINCT tpc.country) = '. count($destinationIds));
//$qb->having('COUNT(DISTINCT tpc.country) = '. count($destinationIds));
$qb->having('COUNT(DISTINCT tc) = '. count($destinationIds));
}
}
$qb->groupBy('p.id, p_dep.id, d.id');

View file

@ -309,7 +309,7 @@ class TravelProgram
private $departures;
/**
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\TravelCountry")
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\TravelCountry", inversedBy="programs")
* @ORM\JoinTable(name="travel_program_country",
* joinColumns={@ORM\JoinColumn(name="program_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="country_id", referencedColumnName="id")}
@ -1501,4 +1501,16 @@ class TravelProgram
{
return $this->options;
}
public function getPreviewImage()
{
foreach ($this->getImages() as $image)
{
if ($image->getType() == 2)
{
return $image;
}
}
return $this->getImages()[0];
}
}