Welcome Guest, Not a member yet? Register   Sign In
Extending abstract classes
#1

[eluser]Unknown[/eluser]
Hey,

I'm currently working on a PHP game engine and I would like to make my object modelisation fit into Codeigniter.

I first started to work with models, but I can only extend my classes from CI_Model or MY_Model. It could be a solution, but I can't extend an already-extended class.

Then, I worked my libraries, but I have another problem :
My Unit class extends from the GenericObject abstract class.
If I don't add the GenericObject class to the $autoload['libraries'] array, I can't instance any Unit object.
If I add the GenericObject class to the $autoload['libraries'] array, then CI tries to instances a GenericObject object and causes a PHP error because you can't instance an abstract class.

Is there any way to let CI know about classes without instancing them ?
#2

[eluser]WanWizard[/eluser]
I'm afraid CI's architecture doesn't suit modern designs very well.

Throw in a class autoloader and you can do anything you want. You can find plenty of references to this on the web, for example this one: http://ajmm.org/2011/06/include-codeigni..._autoload/
#3

[eluser]solid9[/eluser]
@WanWizard
If that is the case do the CI Core dev team has a plan to suite CI into modern designs
with PHP latest version?




Theme © iAndrew 2016 - Forum software by © MyBB