* Suchergebnisse zu Reiseprogrammen verlinken

git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3286 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
uli 2016-12-19 08:54:39 +00:00
parent 23b2c7a7e8
commit 56d6e88451
6 changed files with 78 additions and 5 deletions

View file

@ -97,7 +97,10 @@
alt="Verfügbarkeit"> alt="Verfügbarkeit">
</td> </td>
<td data-title=""><a href="" class="btn btn-primary">buchen</a></td> <td data-title="">
{# #TODO Bad performance #}
<a href="{{ travel_program.page.urlPath }}" class="btn btn-primary">Details</a>
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View file

@ -180,7 +180,7 @@
<a href="{{ page.urlPath ~ '/buchen?nr=' ~ travel_date.name }}" <a href="{{ page.urlPath ~ '/buchen?nr=' ~ travel_date.name }}"
class="btn btn-primary" class="btn btn-primary"
> >
buchen Buchungsformular
</a> </a>
</td> </td>
</tr> </tr>

View file

@ -93,7 +93,7 @@ class DefaultController extends Controller
$stopwatch = $this->get('debug.stopwatch'); $stopwatch = $this->get('debug.stopwatch');
$em = $this->getEntityManager(); $em = $this->getEntityManager();
$destinationsIds = [6,7]; $destinationIds = null;
$destination = $em->getRepository('AppBundle:TravelCountry')->find($request->query->get('c')); $destination = $em->getRepository('AppBundle:TravelCountry')->find($request->query->get('c'));
if ($destination) if ($destination)
{ {
@ -106,7 +106,7 @@ class DefaultController extends Controller
$stopwatch->start('search'); $stopwatch->start('search');
$r = $this->getDoctrine()->getRepository('AppBundle:TravelPeriod')->getTravelProgramsWithTravelDatesForTimePeriod( $r = $this->getDoctrine()->getRepository('AppBundle:TravelPeriod')->getTravelProgramsWithTravelDatesForTimePeriod(
$startDate, $endDate, $destinationsIds, true); $startDate, $endDate, $destinationIds, true);
$stopwatch->stop('search'); $stopwatch->stop('search');
return $this->render('default/pages/search.html.twig', [ return $this->render('default/pages/search.html.twig', [

View file

@ -99,7 +99,7 @@ class Page
/** /**
* @var TravelProgram * @var TravelProgram
* *
* @ORM\OneToOne(targetEntity="AppBundle\Entity\TravelProgram") * @ORM\OneToOne(targetEntity="AppBundle\Entity\TravelProgram", inversedBy="page")
* @ORM\JoinColumn(name="travel_program", referencedColumnName="id") * @ORM\JoinColumn(name="travel_program", referencedColumnName="id")
*/ */
private $travelProgram; private $travelProgram;

View file

@ -133,4 +133,45 @@ class TravelCountry
{ {
return $this->feedbackPage; return $this->feedbackPage;
} }
/**
* Constructor
*/
public function __construct()
{
$this->programs = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add program
*
* @param \AppBundle\Entity\TravelProgram $program
*
* @return TravelCountry
*/
public function addProgram(\AppBundle\Entity\TravelProgram $program)
{
$this->programs[] = $program;
return $this;
}
/**
* Remove program
*
* @param \AppBundle\Entity\TravelProgram $program
*/
public function removeProgram(\AppBundle\Entity\TravelProgram $program)
{
$this->programs->removeElement($program);
}
/**
* Get programs
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPrograms()
{
return $this->programs;
}
} }

View file

@ -331,6 +331,11 @@ class TravelProgram
*/ */
private $options; private $options;
/**
* @ORM\OneToOne(targetEntity="AppBundle\Entity\Page", mappedBy="travelProgram")
*/
private $page;
/** /**
* @var array|TravelDate[] * @var array|TravelDate[]
*/ */
@ -1513,4 +1518,28 @@ class TravelProgram
} }
return $this->getImages()[0]; return $this->getImages()[0];
} }
/**
* Set page
*
* @param \AppBundle\Entity\Page $page
*
* @return TravelProgram
*/
public function setPage(\AppBundle\Entity\Page $page = null)
{
$this->page = $page;
return $this;
}
/**
* Get page
*
* @return \AppBundle\Entity\Page
*/
public function getPage()
{
return $this->page;
}
} }