Skip to content

Instantly share code, notes, and snippets.

@inoas inoas/app-config-bootstrap.php Secret
Created Oct 12, 2017

Embed
What would you like to do?
<?php
//...
/*
* Disable Generic Tables unless cake bake is running
*/
$isCakeBakeRunning = (PHP_SAPI === 'cli' && isset($argv[1]) && $argv[1] === 'bake');
if ($isCakeBakeRunning === false) {
EventManager::instance()->on('Model.initialize', function($event) {
if (get_class($event->getSubject()) === 'Cake\ORM\Table') {
$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
You can’t perform that action at this time.