eZ Community » Blogs » Thiago Campos Viana » Tip: Kernel classes override

By

Tip: Kernel classes override

Saturday 05 November 2011 12:49:57 am

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

In this blog post I will show how to override kernel classes. It is a very known concept, but wasn't in my tip list yet, so, if you don't like the way some kernel classes works you can just create a kernel override, and doing that you'll avoid kernel hacks, which is not recommended.

So, here's the deal. In your extension create a folder named kernel and inside this folder create another one named override, like this:

  • extension
    • myext
      • kernel
        • override

Set the file config.php, add this line:

define( 'EZP_AUTOLOAD_ALLOW_KERNEL_OVERRIDE', true );

Now just copy one of the classes inside kernel/classes to that folder (or the dir structure), run:

  • php bin/php/ezpgenerateautoloads.php -o

Done!

Proudly Developed with from