CodeIgniter Forums
Abstract Model - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Abstract Model (/showthread.php?tid=12009)



Abstract Model - El Forum - 10-02-2008

[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???


Abstract Model - El Forum - 10-02-2008

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


Abstract Model - El Forum - 10-02-2008

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


Abstract Model - El Forum - 10-02-2008

[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.


Abstract Model - El Forum - 10-02-2008

[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


Abstract Model - El Forum - 06-06-2011

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


Abstract Model - El Forum - 06-06-2011

[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


Abstract Model - El Forum - 06-07-2011

[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.