public function prepareData()
 {
     $semester = new Semester();
     $semester['name'] = 'Semester';
     $semester->save();
     foreach (array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday') as $name) {
         $weekday = new Weekday();
         $weekday['name'] = $name;
         $weekday->save();
     }
     for ($i = 0; $i < 3; $i++) {
         $course = new Course();
         $course['name'] = 'Course ' . $i;
         $course['Semester'] = $semester;
         $course->save();
         for ($w = 3; $w < 6; $w++) {
             $cw = new CourseWeekday();
             $cw['Course'] = $course;
             $cw['weekday_id'] = $w;
             $cw->save();
         }
     }
 }
Esempio n. 2
0
 public function enumValuesMethodProvided()
 {
     $this->assertEquals(array(Weekday::$MON, Weekday::$TUE, Weekday::$WED, Weekday::$THU, Weekday::$FRI, Weekday::$SAT, Weekday::$SUN), Weekday::values());
 }
Esempio n. 3
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Weekday.php";
$app = new Silex\Application();
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
$app->get('/', function () use($app) {
    return $app['twig']->render('home.html.twig');
});
$app->get('/day', function () use($app) {
    $date = new Weekday();
    $theDay = $date->dayOfTheWeek($_GET['day'], $_GET['month'], $_GET['year']);
    return $app['twig']->render('day.html.twig', array('day' => $theDay));
});
return $app;