This commit is contained in:
Kevin Adametz 2019-02-06 15:11:58 +01:00
parent 98bd71c760
commit 8b2ec705c9
83 changed files with 3467 additions and 1214 deletions

View file

@ -35,11 +35,13 @@ class FewoLodging
/**
* @var \AppBundle\Entity\FewoLodgingGroup
*
* @ORM\ManyToOne(targetEntity="FewoLodgingGroup")
* @ORM\ManyToOne(targetEntity="FewoLodgingGroup", inversedBy="lodgings")
)
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
* })
*/
private $group;
/**
@ -523,6 +525,18 @@ class FewoLodging
return $this->prices;
}
/**
* Set Price
*
* @param \Doctrine\Common\Collections\Collection
*
* @return FewoLodging
*/
public function setPrices($prices)
{
$this->prices = $prices;
}
/**
* Get prices
*
@ -538,9 +552,31 @@ class FewoLodging
});
}
public function getPricesByFromDateFilter($fromDate)
{
return $this->getPrices()->filter(function(FewoPrice $price) use ($fromDate) {
if(!empty($price->getSeason()))
var_dump($price->getSeason()->getFromDate() );
echo "<br>";
return ($price->getSeason()->getFromDate() >= $fromDate && $price->getSeason()->getToDate() <= $fromDate);
});
}
/**
* Get prices
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPricesFilterNow()
{
$now = new \DateTime();
return $this->getPrices()->filter(function(FewoPrice $price) use ($now) {
if(!empty($price->getSeason()))
return ($price->getSeason()->getToDate() >= $now);
});
}
/**
* Add image
*
* @param \AppBundle\Entity\FewoLodgingImage $image