refactor: New Session class
So that session is shared between classes and does not get overwritten
This commit is contained in:
parent
25f33bba56
commit
1387d836dc
5 changed files with 48 additions and 18 deletions
|
@ -6,9 +6,9 @@
|
|||
namespace Alltube\Controller;
|
||||
|
||||
use Alltube\Config;
|
||||
use Alltube\SessionManager;
|
||||
use Alltube\Video;
|
||||
use Aura\Session\Segment;
|
||||
use Aura\Session\SessionFactory;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Slim\Http\Request;
|
||||
use Slim\Http\Response;
|
||||
|
@ -57,14 +57,12 @@ abstract class BaseController
|
|||
* BaseController constructor.
|
||||
*
|
||||
* @param ContainerInterface $container Slim dependency container
|
||||
* @param array $cookies Cookie array
|
||||
*/
|
||||
public function __construct(ContainerInterface $container, array $cookies = [])
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->config = Config::getInstance();
|
||||
$this->container = $container;
|
||||
$session_factory = new SessionFactory();
|
||||
$session = $session_factory->newInstance($cookies);
|
||||
$session = SessionManager::getSession();
|
||||
$this->sessionSegment = $session->getSegment(self::class);
|
||||
|
||||
if ($this->config->stream) {
|
||||
|
|
|
@ -42,11 +42,10 @@ class FrontController extends BaseController
|
|||
* BaseController constructor.
|
||||
*
|
||||
* @param ContainerInterface $container Slim dependency container
|
||||
* @param array $cookies Cookie array
|
||||
*/
|
||||
public function __construct(ContainerInterface $container, array $cookies = [])
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
parent::__construct($container, $cookies);
|
||||
parent::__construct($container);
|
||||
|
||||
$this->localeManager = $this->container->get('locale');
|
||||
$this->view = $this->container->get('view');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue