Added $type as an argument.
See https://github.com/cakephp/cakephp/issues/2122
Merge pull request #3471 from coencoppens/issue-2122

Issue 2122