Welcome Guest, Not a member yet? Register   Sign In
Referring to parent model instance.
#1

[eluser]xerobytez[/eluser]
Hey guys, so I'm racking my brain over this. I've created a base model that has a lot of reusable code in it that I extend with several other models. I'd like to have some methods with the same name in both the parent model and child model, how would I properly refer to the method in the parent model from the child model if they are named the same. If I use $this->method() it refers to the method in the model its being called from, and I can't seem to get method chaining to work If I'm using parent:: since its static. Anyone have any ideas?
#2

[eluser]Aken[/eluser]
Parent::method() doesn't necessarily mean that the method is static - you can use this just fine (CI uses it all over with the __construct() method). There's a perfect example of calling a parent method of the same name on PHP.net: http://www.php.net/manual/en/language.oop5.basic.php

If that doesn't help, post some of your code and explain what you're trying to do and what is actually happening.




Theme © iAndrew 2016 - Forum software by © MyBB