I have been given a web site to edit but I cant start it yet. Im using Apache and MySql. The site is live and seems to work just fine. But when I start it localy I get the following message:
Notice: Undefined property: Phalcon\Di\FactoryDefault::$di in C:\xampp\htdocs\app\app.php on line 167
Fatal error: Call to a member function getShared() on null in C:\xampp\htdocs\app\app.php on line 167
Code:
protected function initDispatcher( $options = [] ) {
$this->di['dispatcher'] = function() {
$eventsManager = $this->di->getShared( 'eventsManager' );
$eventsManager->attach( 'dispatch:beforeDispatch' , new Security( $this->di ) );
$dispatcher = new \Phalcon\Mvc\Dispatcher();
$dispatcher->setEventsManager( $eventsManager );
return $dispatcher;
};
Edit: I started it on PhpStorm now didnt have one, so there are few errors I couldnt notice on Notepad++. It says that it doesnt recognize Phalcon namespace. Which makes all other Phalcon classes unusable.
So that leads me to the next question - How can I define the namespace Phalcon in a project?