public function __do($showtime_id) { if ($showtime_id = intval($showtime_id)) { $showtime = \models\entities\Showtime::manager()->getEntity($showtime_id); if ($showtime && $showtime->url) { $showtime->update(array('redirects' => new \DbTableFunction("redirects+1")), 'id'); $this->_request->redirect($showtime->url); } } $this->_request->redirect('http://joseph.orilogbon.me'); }
/** * PinServce constructor. * @param int $showtimeId * @param $reminderMinutes * @param $userToken * * @param GeocodeCached $geocode */ public function __construct($showtimeId, $reminderMinutes, $userToken, GeocodeCached $geocode) { $this->showtime = Showtime::findOne($showtimeId); if (!$this->showtime) { throw new \InvalidArgumentException("Specified showtime ID [{$showtimeId}] is not valid."); } $this->reminderMinutes = $reminderMinutes; $this->userToken = $userToken; $timezone = TimeZoneService::instance()->getTimeZone($geocode) ?: 'Europe/London'; //default to UTC if all failes $this->dateTimeZone = new \DateTimeZone($timezone); }
protected function initRelations() { $this->setOneToMany('nearbys', TheatreNearby::manager(), 'distance_m')->setOneToMany('showtimes', Showtime::manager(), 'show_date DESC, show_time ASC'); }
public static function cleanShowdates() { $staleDate = date('Y-m-d', strtotime("-3 days")); $deleted = Showtime::table()->delete("show_date <= '{$staleDate}'"); \SystemLogger::info("Cleaned ", $deleted, "show dates"); return $deleted; }