public function register(Application $app) { $app["propel"] = $app->protect(function () use($app) { if (!class_exists('\\Propel\\Runtime\\Propel')) { throw new \Exception("Can't register Propel, it is not installed or not loaded!"); } $this->configure($app); $this->initPropel(); }); }
public function register(Application $app) { $app["cerberus"] = $app->protect(function () use($app) { if (!class_exists('\\Alchemy\\Component\\Cerberus\\Cerberus')) { throw new \Exception("Can't register Cerberus, it is not installed or not loaded!"); } $config = $app["config"]->getSection("cerberus"); if (empty($config)) { $config = $app["config"]->getSection("database"); } if (empty($config)) { throw new \RuntimeException("Database configuration is missing."); } $regionalConfig = $app["config"]->getSection('regional'); $config = self::configure($config); $cerberus = new Cerberus($config); $cerberus->setLocale($regionalConfig); $cerberus->init(); return $cerberus; }); }