We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

getDI

Code:

<?php
    class PMA extends \Phalcon\DI\Injectable {
        public static function uid () {
            var_dump($this -> getDI('session'));
        }
    }
?>

But I didn't get session.



98.9k

In a static function you have to use:

public static function uid ()
{
    var_dump(Phalcon\Di::getDefault()->getSession());
}

https://docs.phalcon.io/en/latest/reference/di.html#accessing-the-di-in-a-static-way



20.5k
edited Oct '14

In a static function you have to use:

public static function uid ()
{
  var_dump(Phalcon\Di::getDefault()->getSession());
}

https://docs.phalcon.io/en/latest/reference/di.html#accessing-the-di-in-a-static-way

Elder what time is it now you there?If I didn't guess wrong, should be in the middle of the night?I admire you so professional!



98.9k

It's 23:00 here :D



20.5k

I'd like to make a small suggestion, website can give a CHM version of the manual, the domestic many of us are really want to learn the framework, but mostly because can't read the document and give up, although I try to help them, but my own level is not so good



20.5k

I'd like to make a small suggestion, website can give a CHM version of the manual, the domestic many of us are really want to learn the framework, but mostly because can't read the document and give up, although I try to help them, but my own level is not so good

I see your spirit of dedication, I very admire, I also will continue to support phalcon