private function __construct() { //load providers $serviceProvidersDir = __DIR__ . DS . 'showtimeproviders'; $namespace = __NAMESPACE__ . '\\' . 'showtimeproviders'; $scanner = new \PackageScanner($serviceProvidersDir, $namespace, ShowtimeServiceProvider::getClass()); foreach ($scanner->getAllInstantiable() as $provider) { $this->serviceProviderList[] = $provider->newInstance(); } if (!count($this->serviceProviderList)) { throw new InvalidArgumentException("There are no service providers defined for showtimes."); } //ComparableObjectSorter::sort($this->serviceProviderList, false, true); shuffle($this->serviceProviderList); //initialize showtime manager $this->showtimeManager = Showtime::manager(); $this->theatreManager = Theatre::manager(); $this->theatreNearByManager = TheatreNearby::manager(); }
protected function initRelations() { $this->setManyToOne('theatre', Theatre::manager()); }