jonathangeiger / kohana-jelly

See the link below for the most up-to-date code
https://github.com/creatoro/jelly
MIT License
146 stars 34 forks source link

It is impossible to change database instance of Jelly_Model dynamically #182

Open milosh-dev opened 13 years ago

milosh-dev commented 13 years ago

Scenario:

There is a model, which extends Jelly_Model.

When the code later wants to save the object into different database via controller (e.g. for unittesting, or for other reasons) it is impossible to initialize the model with diffrenet database.

$mymodel = Jelly::factory('mymodel'); $mymodel->meta()->db('somedatabase'); $mymodel->set($data)->save();

Excpected result: The data of $mymodel is saved in respective table at the database 'somedatabase'.

Actual result: The data of $mymodel is saved in default database instead.