public function ClassWithClosure::getEventsForDate

Parameters

integer $year:

integer $month:

integer $day:

Return value

\Doctrine\Common\Collections\ArrayCollection

File

drupal/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithClosure.php, line 40

Class

ClassWithClosure
Plugin annotation @AnnotationTargetAll("Foo");

Namespace

Doctrine\Tests\Common\Annotations\Fixtures

Code

public function getEventsForDate($year, $month, $day) {
  $extractEvents = null;

  // check if date of item is inside day given
  $extractEvents = $this->events
    ->filter(function ($item) use ($year, $month, $day) {
    $leftDate = new \DateTime($year . '-' . $month . '-' . $day . ' 00:00');
    $rigthDate = new \DateTime($year . '-' . $month . '-' . $day . ' +1 day 00:00');
    return $leftDate <= $item
      ->getDateStart() && $item
      ->getDateStart() < $rigthDate;
  });
  return $extractEvents;
}