kapitansen
@kapitansen
Веб-погромист

Как получить данные сессии phalcon в методе другого класса?

Вопрос скорее всего больше про ООП, но так получилось, что глубокое ООП у меня началось с легаси-проекта на Phalcon.

В классе IndexController есть такое:
namespace manage\controllers;

use common\models\ScrapedVideos;
use common\types\VideoStatusType;
use manage\models\AdminUsers;
use manage\models\UserVideos;

class IndexController extends ManageController
{

    public function loginAction()
    {

            if (!$this->session->isStarted()) {
                $this->session->start();
            }

            $this->session->set('adminUser', $admin);
            return $this->response->redirect('/manage/index/index/');
        }

        return $this->view;
    }
}


А потом мне нужно получить $this->session->get('adminUser') внутри вот этого:

namespace manage\models;

use common\helpers\SessionHelper;
use common\models\CollectionRepository;
use common\models\FavoriteUserVideos;
use common\models\Thumb;
use common\models\UserVideosVotes;
use DateTime;
use manage\components\CdnFtpClient;
use Phalcon\Db\Adapter\Pdo\Mysql;
use Phalcon\Di;
use Phalcon\Logger\Adapter\File;

class UserVideos extends \common\models\UserVideos
{
    public function deleteVideo($id)
    {
         $removedBy =  $this->session->get('adminUser');
    }
}
  • Вопрос задан
  • 73 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы