It looks like you're new here. If you want to get involved, click one of these buttons!
In Fuel. 1.4.x the fix generated by https://forum.getfuelcms.com/discussion/comment/11495 worked fine.
I've now upgraded to v1.5.1 and the bug has returned despite the original bugfix being present.
In my controller:
function __construct() {
...
$this->load->model('anotherdb_model');
Where anotherdb_model contains:
protected $dsn = 'anotherdb';
Causes:
An Error Was Encountered
Unable to connect to your database server using the provided settings.
...when rendering a page:
$this->fuel->pages->render('test_view', $vars, $page_init);
Removing the load->model stanza renders the page as expected.
It seems loading the anotherdb_model flips the dsn.
I've tried adding a dummy model, with the default dsn set, to the __construct after anotherdb_model but it doesn't flip back.
Any suggestions?
Comments
Further information:
Taking $this->load->model('anotherdb_model'); out of the __construct and putting it into the controller function that uses it and replacing it with the $this->load->model('dummy_model'); stanza seems to get things working again.
Without $this->load->model('dummy_model'); in __construct, the error remains.
It's as if the first model load in __construct become the arbiter of the dsn for the model?
I've pushed an update here to hopefully help with your issue. Let me know if that does the trick:
https://github.com/daylightstudio/FUEL-CMS/commit/9f4c0450ea734d582c18b297954373504de7fd87
That worked. Thanks.