i googled this error in many ways but only could find irrelevant messages
i am migrating a cakephp 4.2 PHP application to cakephp 5 and only the 'default' database is usable
in my app_local.php i have declared several databases (as i did in cakephp 4) and only the 'default' is working.
when i use
/bin/cake schema_cache build --connection default
the cache files are generated in tmp/cache/model
BUT any other db defined i try to use i will get the error
Datasource class
XXX
could not be found.
if i switch the default configuration with another DB name then the cache is generated. it really looks like only one db configuration is taken, the 'default' one
all databases are on the same host, same user, same mysql configuration
if i try to declare the database with code:
ConnectionManager::setConfig('XXX', $config);
$connection = ConnectionManager::get('XXX');
i will get the error that the source is already declared, and if i remove the configuration of the XXX db in app_local.php, then i get back to the error
Missing Datasource
Datasource class
XXX
could not be found.
i regenerated the composer several times with
composer update dumpautoload
other posts about this error are usually very old, wrong configuration or database not accessible, so i don't know if others had the same issue on the latest versions