Welcome Guest, Not a member yet? Register   Sign In
convert string to object
#11

[eluser]Randy Casburn[/eluser]
Yes - you are correct. I see your point. Another scope problem. Watch out though, scope problems are in another thread ;-)
#12

[eluser]zeratool[/eluser]
Scriptor , thanks for the reply, can you please edit the pastebin code for the fix you got in mind? Thanks again.
#13

[eluser]zeratool[/eluser]
Scriptor, actually the implementation is done on the subclass, not in ModelManager, its on the file "models/test.php"

class test extends ModelManager { // code goes here }

Anybody?
#14

[eluser]Scriptor[/eluser]
Zeratool, this is basic OOP knowledge. The 'test' class does not have the add method. Since it inherits from ModelManager, PHP goes and calls the method from test's parent class, in this case ModelManager. That is why the error you're getting is coming from the ModelManager.php file.

Also, sorry but I won't edit the code for you, since that really won't help you learn. So, in the following code at lines 18 and 19 ModelManager.php:
Code:
$this->CI->$model->set_values($data);
$ok = $this->CI->$model->save();

You never declared the $model variable in the add() method. For the best solution, I'd set $this->mode='test' in the constructor of your test class, then use $this->CI->{$this->model}...etc. in the two lines I quoted above.
#15

[eluser]taewoo[/eluser]
This isn't a suggestion or solution the post... but i've been trying to do this via having a generic model class that I extend from the CI model.. then extending THAT generic model:

http://ellislab.com/forums/viewthread/82026/#425966




Theme © iAndrew 2016 - Forum software by © MyBB