CakePHP not inheriting custom app_controller and app_model

Main Thread March 3, 2011 • 1 min read

My CakePHP project fell down a rabbit hole earlier over something in hindsight was a no-brainer. I created a custom app_controller.php and app_model.php in my app directory. I copied the respective files from cake/libs/controller and cake/libs/model. I added my customizations and refreshed the page. Nothing. I checked the filenames and output a few debug() calls. Still nothing. I added beforeFilter() with just an echo. Nothing! My controllers and models weren't inheriting any of the custom parent methods. Finally, it hit me – clear the cache. It worked.

Maybe that is a rookie mistake. Nonetheless, hopefully that saves someone the 15 minutes I lost. Clearing the cache was actually the solution to a problem a few months back. Which is actually the only reason I tried it. So when in doubt with CakePHP, clear the cache.

Find this interesting? Let's continue the conversation on Twitter.