Importing core files has changed in CakePHP 2.x, which means you have to change App::import('Sanitize');
to App::uses('Sanitize', 'Utility');
. Also remove the $uses
statement, it’s for loading models and Sanitize
is not a model.
With those modifications, your snippet will look like:1
2
3
4
5
6
7
8App::uses('Sanitize', 'Utility');
class MyController extends AppController
{
function Foo()
{
$test = Sanitize::paranoid($data);
}
}