refactor: New Session class

So that session is shared between classes and does not get overwritten
This commit is contained in:
Pierre Rudloff 2019-04-22 17:00:51 +02:00
parent 25f33bba56
commit 1387d836dc
5 changed files with 48 additions and 18 deletions

View file

@ -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) {