can I use a model in bootstrap.php to get an array with find() from database ?
like this :
$Setting = ClassRegistry::init('Setting');
$Settings = $Setting->find('all');
thanks
can I use a model in bootstrap.php to get an array with find() from database ?
like this :
$Setting = ClassRegistry::init('Setting');
$Settings = $Setting->find('all');
thanks
You need to manually load the used classes then, if you really must use core internal stuff that early.
try
App::uses('ClassRegistry', 'Utility');
before you actually use ClassRegistry.
Write in bootstrap.php
App::uses('ClassRegistry', 'Utility');
$Setting = ClassRegistry::init('ModelName');
© 2022 - 2024 — McMap. All rights reserved.