CodeIgniter Forums
GAS ORM Issue - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: GAS ORM Issue (/showthread.php?tid=58359)



GAS ORM Issue - El Forum - 06-06-2013

[eluser]jon74[/eluser]
Hi All,

After looking into various ORM solutions I decided to try GAS, I've downloaded and setup the files as per the user guide, and have set the GAS model path and namespace as follows: 'Objects' => APPPATH.'objects'. The autoload for library 'gas' has been added and all files are in place.

Rather than use the default CI 'models' directory, I do not want to replace the CI_Models, rather leverage GAS from within them so I created the objects folder.

I've auto-generated all of the GAS model files, and they exist in the objects folder.

All works fine and the application runs, until I try to invoke one of the GAS models, it fails with:

Fatal error: Class 'Objects\Cars' not found

Any advice or pointers would be greatly appreciated, I've re-traced the guide several times.

Thanks



GAS ORM Issue - El Forum - 06-06-2013

[eluser]jon74[/eluser]
If it helps anyone else, I only managed to get it to work when I retained the 'Model' namespace, but change the directory to 'objects'.

array('Model' => APPPATH.'objects');

The classes are now initiated and loaded by the autoloader


GAS ORM Issue - El Forum - 06-06-2013

[eluser]jon74[/eluser]
I though I was there! Smile I can save records but when I try to retrieve them with Gas::factory I get:

Fatal error: Call to undefined method Gas::factory()


GAS ORM Issue - El Forum - 06-06-2013

[eluser]toopay[/eluser]
Hey @jon74. factory method is not longer exists in version 2.x. To retrieve some entity records, you could just call them :

Code:
$someuser = Model\User::find(1);
echo $someuser->name;

As described here.

There are also "functional documentation" (which people used to call them "unit-test") available in gas orm repository : https://github.com/toopay/gas-orm/tree/master/third_party/gas/tests/testCases . Next time you've stumbled upon something with these library, thats will be the best place to start looking for a solution, beside this forum.

Cheers!