Hi,
I would like to query a remote database (a MySQL database which I can connect with the mysql console client). This database is used and feed by another app. I would like to open it read-only.
So I set up a new datasource in my app.php file.
Then I added a src/Model/Table/FeedcategoriesTable.php file
<?php
// src/Model/Table/FeedcategoriesTable.php
namespace App\Model\Table;
use Cake\ORM\Table;
class FeedcategoriesTable extends Table
{
public static function defaultConnectionName() {
return ‘otherdb’;
}
public function initialize(array $config)
{
$this->addBehavior(‘Timestamp’);
}
}
But I got a : Exception: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘cakephp1.feedcategories’ doesn’t exist in [/home/user1/myapp/vendor/cakephp/cakephp/src/Database/Schema/Collection.php, line 130]
The table should be the one referenced in the otherdb datasource, but the default one (cakephp1) is always used.
Any idea what I a missing or doing wrong ?
Thanks,
yts