Backporting overwrite() from 3.0 to 2.6.

Backport https://github.com/cakephp/cakephp/issues/3183 to 2.6
Gonna love it :)