Adaptated for CakePHP 2.4