0
votes

I have been working with CakePHP for sometime and for some reason today i started getting the Missing Controller Exception - Error: BlogController could not be found. while trying to access a /blog route.

I have created the blog.ctp file inside of the Pages directory.

And this is my route code

$routes->connect('/blog', ['controller' => 'Pages', 'action' => 'blog'], ['routeClass' => 'DashedRoute']);

And inside my PagesController.php i have created the blog function as well.

public function blog()
{
    $this->viewBuilder()->setlayout('frontend');
}

Am i doing something wrong here? Is it a bug in the version of CakePHP I'm using? Because i have never gotten this error earlier.

I'm using CakePHP - 3.7.4.

1

1 Answers

0
votes

Ok, So if any of you face this issue just get a new composer composer create-project --prefer-dist cakephp/app

Either i had missing files or something got deleted. Everything works after a fresh install.