Phally/lazy_model — Issue #5: 'Cannot redeclare class AppModel in app_model.php'
Author: sime
Created: 2011-11-15 13:10:34+00:00
State: open

I've inherited a CakePHP application and it uses the LazyModel plugin.

Though I'm attempting to upgrade from 1.3.10 to 1.3.11 and I get the following error:

Fatal error: Cannot redeclare class AppModel in app_model.php

Same issue in 1.3.12 and 1.3.13

Also in app_model.php is the Sanitize library is being imported, right under the LazyModel App::import().

I believe the core change in question is evident in the below commit[1]. When removing App::import('Model', 'ConnectionManager'); from cake/libs/santize.php I don't have a problem.

Do you have any suggestion why this is, and if possible a best practice around this problem?

[1] https://github.com/cakephp/cakephp/commit/5ffab8c

Thanks