/**
  * {@inheritdoc}
  */
 public function boot(Application $app)
 {
     if (!isset($app['db.event_manager'])) {
         throw new FatalErrorException('The DoctrineServiceProvider is not registered in this application');
     }
     if (Environment::get('DOCTRINE_EXTENSION_ENABLE_SLUGGABLE') === true) {
         $listener = new SluggableListener();
         $app['db.event_manager']->addEventSubscriber($listener);
     }
     if (Environment::get('DOCTRINE_EXTENSION_ENABLE_TREE') === true) {
         $listener = new TreeListener();
         $app['db.event_manager']->addEventSubscriber($listener);
     }
     if (Environment::get('DOCTRINE_EXTENSION_ENABLE_LOGGABLE') === true) {
         $listener = new LoggableListener();
         $app['db.event_manager']->addEventSubscriber($listener);
     }
     if (Environment::get('DOCTRINE_EXTENSION_ENABLE_TIMESTAMPABLE') === true) {
         $listener = new TimestampableListener();
         $app['db.event_manager']->addEventSubscriber($listener);
     }
     if (Environment::get('DOCTRINE_EXTENSION_ENABLE_TRANSLATABLE') === true) {
         $listener = new TranslatableListener();
         if (!isset($app['translator'])) {
             throw new FatalErrorException('The TranslationServiceProvider is not registered in this application');
         }
         $listener->setTranslatableLocale($app['translator']->getLocale());
         $listener->setDefaultLocale($app['translator']->getLocale());
         $app['db.event_manager']->addEventSubscriber($listener);
     }
     if (Environment::get('DOCTRINE_EXTENSION_ENABLE_SORTABLE') === true) {
         $listener = new SortableListener();
         $app['db.event_manager']->addEventSubscriber($listener);
     }
 }
 /**
  * collect vars and sets them to the DIC
  *
  * @param Container $container
  */
 protected function addEnvVarsToApp(Container $container)
 {
     $envVars = array_merge($_SERVER, $_ENV);
     foreach ($envVars as $envVar => $empty) {
         if ($this->findEnvironmentVariable($envVar)) {
             $container['dotenv.' . strtolower($envVar)] = Environment::get($envVar);
         }
     }
 }
Пример #3
0
<?php

use App\Application;
use App\ControllerProvider\ApiControllerProvider;
use App\ControllerProvider\PageControllerProvider;
use Cekurte\Environment\Environment;
use Cekurte\Silex\Manager\Provider\ManagerServiceProvider;
use Symfony\Component\HttpFoundation\Request;
$app = new Application();
$app['debug'] = Environment::get('APP_DEBUG');
$app['cekurte.manager.providers'] = (require CONFIG_PATH . DS . 'manager.php');
$app->register(new ManagerServiceProvider());
Request::enableHttpMethodParameterOverride();
require CONFIG_PATH . DS . 'error.php';
$app->mount('/', new PageControllerProvider());
$app->mount('/api', new ApiControllerProvider());
$app->after($app["cors"]);
return $app;
Пример #4
0
<?php

use Cekurte\Environment\Environment;
return ['migrations.directory' => ROOT_PATH . DS . Environment::get('DOCTRINE_MIGRATIONS_DIRECTORY'), 'migrations.name' => Environment::get('DOCTRINE_MIGRATIONS_NAME'), 'migrations.namespace' => Environment::get('DOCTRINE_MIGRATIONS_NAMESPACE'), 'migrations.table_name' => Environment::get('DOCTRINE_MIGRATIONS_TABLENAME')];
Пример #5
0
<?php

use Cekurte\Environment\Environment;
return ['locale' => Environment::get('TRANS_LOCALE'), 'locale_fallbacks' => Environment::get('TRANS_LOCALE_FALLBACKS'), 'translation.directory' => STORAGE_PATH_I18N];
Пример #6
0
 /**
  * Get value from environment.
  *
  * @param string $key
  * @param mixed  $defaultValue
  *
  * @return mixed
  *
  * @deprecated
  */
 function env($name, $default = null)
 {
     return Environment::get($name, $default);
 }
Пример #7
0
 /**
  * @expectedException \Cekurte\Environment\Exception\FilterException
  */
 public function testGetAllFilterException()
 {
     Environment::getAll([new \ArrayObject()]);
 }
Пример #8
0
<?php

use Cekurte\Environment\Environment;
return ['swiftmailer.use_spool' => Environment::get('SWIFTMAILER_USE_SPOOL'), 'swiftmailer.options' => ['host' => Environment::get('SMTP_HOST'), 'port' => Environment::get('SMTP_PORT'), 'username' => Environment::get('SMTP_USERNAME'), 'password' => Environment::get('SMTP_PASSWORD'), 'encryption' => Environment::get('SMTP_ENCRYPTION'), 'auth_mode' => Environment::get('SMTP_AUTH_MODE')]];
Пример #9
0
<?php

use Cekurte\Environment\Environment;
return ['cors.allowOrigin' => Environment::get('CORS_ALLOW_ORIGIN'), 'cors.allowMethods' => Environment::get('CORS_ALLOW_METHODS'), 'cors.maxAge' => Environment::get('CORS_MAX_AGE'), 'cors.allowCredentials' => Environment::get('CORS_ALLOW_CREDENTIALS'), 'cors.exposeHeaders' => Environment::get('CORS_EXPOSE_HEADERS')];
Пример #10
0
<?php

use Cekurte\Environment\Environment;
return ['dbal' => ['db.options' => ['driver' => Environment::get('DB_DRIVER'), 'host' => Environment::get('DB_HOST'), 'dbname' => Environment::get('DB_NAME'), 'user' => Environment::get('DB_USERNAME'), 'password' => Environment::get('DB_PASSWORD'), 'charset' => Environment::get('DB_CHARSET'), 'port' => Environment::get('DB_PORT')]], 'orm' => ['orm.proxies_dir' => ROOT_PATH . DS . Environment::get('DOCTRINE_ORM_PROXIES_DIRECTORY'), 'orm.proxies_namespace' => Environment::get('DOCTRINE_ORM_PROXIES_NAMESPACE'), 'orm.auto_generate_proxies' => Environment::get('DOCTRINE_ORM_AUTO_GENERATE_PROXIES'), 'orm.default_cache' => Environment::get('DOCTRINE_ORM_DEFAULT_CACHE'), 'orm.em.options' => ['mappings' => [['type' => Environment::get('DOCTRINE_ORM_MAPPING_DEFAULT_TYPE'), 'namespace' => Environment::get('DOCTRINE_ORM_MAPPING_DEFAULT_NAMESPACE'), 'path' => ROOT_PATH . DS . Environment::get('DOCTRINE_ORM_MAPPING_DEFAULT_PATH')]]]]];
Пример #11
0
 public function testGetEnvironmentVariable()
 {
     putenv('putenv=true');
     $this->assertEquals(true, Environment::get('putenv'));
     $_ENV['_ENV'] = 'true';
     $this->assertEquals(true, Environment::get('_ENV'));
     $_SERVER['_SERVER'] = 'true';
     $this->assertEquals(true, Environment::get('_SERVER'));
 }
Пример #12
0
<?php

use Cekurte\Environment\Environment;
return ['twig.path' => APP_PATH, 'twig.class_path' => VENDOR_PATH . DS . 'twig' . DS . 'twig' . DS . 'lib', 'twig.options' => ['cache' => STORAGE_PATH_CACHE . DS . 'twig.cache', 'debug' => Environment::get('APP_DEBUG')]];
 /**
  * @return string
  */
 protected function getNamespace()
 {
     return Environment::get('DOCTRINE_ORM_MAPPING_DEFAULT_NAMESPACE');
 }