Welcome Guest, Not a member yet? Register   Sign In
Abstract Model
#1

[eluser]Moon 111[/eluser]
I have an abstract model and a few classes that extend them, but when I try to load the class that extends it, it says the parent class can't be found.

Let me show you what I mean:

Code:
Abstract Class Blah Extends Model {

    public function __construct() {

        parent::__construct();
    }

    abstract public function test();
}

Code:
Class BlahBlah Extends Blah {

    public function test() {

        // Do something
    }
}

And now it tells me it can't find Class Blah (I can't just load it as it's an abstract class...)

What do I do?

By the way, hasn't CI heard of autoload???
#2

[eluser]wiredesignz[/eluser]
Haven't you heard of include? Tongue
#3

[eluser]Moon 111[/eluser]
It seemed kind've primitive...
#4

[eluser]wiredesignz[/eluser]
[quote author="Moon 111" date="1222950239"]It seemed kind've primitive...[/quote]

Write your own __autoload function then. But remember you still have to write the include inside the __autoload function yourself.

Good luck.
#5

[eluser]Moon 111[/eluser]
I suppose I can't have static classes then? Or can I do that if I create an autoload?

Where would I put the autoload?

Thanks,
- Moshe
#6

[eluser]benb[/eluser]
i have the same problem does anyone know the solution for that?
#7

[eluser]InsiteFX[/eluser]
The answer is above by wiredesignz and I also answered you in your thread use includes!

And you cannot use a Class named factory because factory is a Class Method!

InsiteFX
#8

[eluser]benb[/eluser]
[quote author="InsiteFX" date="1307435229"]The answer is above by wiredesignz and I also answered you in your thread use includes!

And you cannot use a Class named factory because factory is a Class Method!

InsiteFX[/quote]

include or require not works.

i tried require_once base_url . 'models/user_m.php';
also application/models/user_m.php
its block or something by codeigniter.

i found a solution with out using abstract but its looks ugly, when i search 'codeigniter abstract' in google. i saw that people got suggests to move to other frameworks.




Theme © iAndrew 2016 - Forum software by © MyBB