-
-
Save inoas/78f24f3024a449af3e2675ae61d439b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Disable generic table classes unless cake bake is running | |
*/ | |
if ((PHP_SAPI === 'cli' && array_key_exists(1, env('argv')) && env('argv')[1] === 'bake') === false) { | |
// TODO entity initialize => similar error | |
EventManager::instance()->on('Model.initialize', function($event) { | |
if (get_class($event->getSubject()) === Table::class) { | |
$msg = sprintf( | |
'Missing or miss-referenced table class for database table %s (auto-tables).', | |
$event->getSubject()->getTable() | |
); | |
if (Configure::read('debug') === false) { | |
Log::warning($msg); | |
} else { | |
throw new InternalErrorException($msg); | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment