Welcome Guest, Not a member yet? Register   Sign In
Config Static Variables Not Working
#15

(08-04-2021, 07:20 PM)paulbalandan Wrote: If you have your own initController() method in AdminController, then you need to call the parent initController first.
PHP Code:
class AdminController extends BaseController
{
    ...

    public function initController(RequestInterface $requestResponseInterface $responseLoggerInterface $logger)
    {
        parent::initController(); // initializes all code in BaseController
        echo self::$var_test;
    }

Thankyou for your time but we need to call initController() with required arguments. I have found a work around, I have created a separate method in BaseController & can call it whenever needed. But its a new learning for me that BaseController initController is called only after child controller constructor.
Reply


Messages In This Thread
Config Static Variables Not Working - by myo - 08-03-2021, 06:08 AM
RE: Config Static Variables Not Working - by myo - 08-03-2021, 08:08 PM
RE: Config Static Variables Not Working - by myo - 08-03-2021, 09:56 PM
RE: Config Static Variables Not Working - by myo - 08-03-2021, 10:37 PM
RE: Config Static Variables Not Working - by myo - 08-04-2021, 02:52 AM
RE: Config Static Variables Not Working - by myo - 08-04-2021, 09:03 AM
RE: Config Static Variables Not Working - by myo - 08-05-2021, 03:57 AM
RE: Config Static Variables Not Working - by myo - 08-06-2021, 06:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB