PHP code example of blast-project / doctrine-session-bundle
1. Go to this page and download the library: Download blast-project/doctrine-session-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
blast-project / doctrine-session-bundle example snippets
//...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
//...
new Blast\DoctrineSessionBundle\BlastDoctrineSessionBundle(),
];
//...
}
//...
}
use Blast\DoctrineSessionBundle\Handler\DoctrineORMHandler;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
//...
$doctrinehandler = new DoctrineORMHandler(
$this->get('doctrine'),
'Blast\DoctrineSessionBundle\Entity\Session');
$storage = new NativeSessionStorage(
array(),
$doctrinehandler
);
$session = new Session($storage);
$session->start();
//...