Example #1
0
 /**
  * {@inheritdoc}
  */
 public function register(DiInterface $di)
 {
     $config = $di->get('config');
     $di->set(self::SERVICE_NAME, function () use($config) {
         $sessionAdapter = new SessionAdapter($config->session->toArray());
         if (!$sessionAdapter->isStarted()) {
             $sessionAdapter->start();
         }
         return $sessionAdapter;
     }, true);
 }
Example #2
0
 public static function setUpBeforeClass()
 {
     $di = DI::getDefault();
     $config = $di->get('config');
     /**
      * Start the session the first time some component request the session service
      */
     $di->set('session', function () use($config) {
         $sessionAdapter = new FilesAdapter($config->session->toArray());
         if (!$sessionAdapter->isStarted()) {
             $sessionAdapter->start();
         }
         return $sessionAdapter;
     }, true);
     $di->set('sessionManager', function () use($di) {
         $session = new \Vegas\Session($di->get('session'));
         return $session;
     }, true);
     DI::setDefault($di);
 }
Example #3
0
 */
$di->set('collectionManager', function () {
    return new \Phalcon\Mvc\Collection\Manager();
}, true);
/**
 * MongoDB connection
 */
$di->set('mongo', function () use($config) {
    $mongo = new \MongoClient();
    return $mongo->selectDb($config->mongo->db);
}, true);
/**
 * Start the session the first time some component request the session service
 */
$di->set('session', function () use($config) {
    $sessionAdapter = new SessionAdapter($config->session->toArray());
    if (!$sessionAdapter->isStarted()) {
        $sessionAdapter->start();
    }
    return $sessionAdapter;
}, true);
$di->set('sessionManager', function () use($di) {
    $session = new Vegas\Session($di->get('session'));
    return $session;
}, true);
/**
 * Password manager for standard user
 */
$di->set('userPasswordManager', '\\Vegas\\Security\\Password\\Adapter\\Standard', true);
/**  authentications **/
//standard user