예제 #1
0
 /**
  * Uses the configuration from the application and returns the LooEntityManager.
  *
  * @return LooEntityManager
  */
 public function getEntityManager()
 {
     if (empty(static::$entityManager)) {
         $config = Setup::createAnnotationMetadataConfiguration(Settings::getEntityPaths(), Settings::isDevMode());
         $connection = Settings::getDbConnection();
         static::$entityManager = LooEntityManager::create($connection, $config);
     }
     return static::$entityManager;
 }
예제 #2
0
 /**
  * Run the application. If there is an exception thrown send an 500.
  *
  * @param Request $request
  */
 public function run(Request $request)
 {
     try {
         $this->handleRequest($request);
     } catch (Exception $e) {
         $logger = $this->masterFactory->getDebugFactory()->getErrorLogger();
         $logger->error($e->getMessage() . PHP_EOL . $e->getTraceAsString());
         header(sprintf('Status: %s', Response::getMessageForCode(500)));
         if (Settings::isDevMode()) {
             echo $e->getMessage() . PHP_EOL;
             echo '<pre>';
             echo $e->getTraceAsString();
             echo '</pre>';
         }
     }
 }