Welcome Guest, Not a member yet? Register   Sign In
GAS ORM Issue
#1

[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
#2

[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
#3

[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()
#4

[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/m.../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!




Theme © iAndrew 2016 - Forum software by © MyBB