Answer the question
In order to leave comments, you need to log in
How to get phalcon session data in another class method?
The question is most likely more about OOP, but it so happened that my deep OOP started with a legacy project on Phalcon.
The IndexController class has this:
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;
}
}
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');
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question