Welcome Guest, Not a member yet? Register   Sign In
GAS ORM factory not working
#1

Hi,

I have recently downloaded GAS ORM and I am trying to do some basic stuff to test how it works with Codeigniter.

In my controller, I have the following code to test creating a 'user' record:
$data = array('username' => 'test user', 'password' => 'test password', 'email' => 'test email');
$u = Gas::factory('User')->fill($data);

But, it produces the following error. Can anyone help please as I'm not sure what the issue is. I have simply followed the instructions on the GAS ORM website and copied and pasted some examples. It's driving me nuts!

Fatal error: Uncaught TypeError: Argument 1 passed to Gas::exception() must be an instance of Exception, instance of Error given, called in C:\server\webroot\myApp\application\libraries\gas.php on line 77 and defined in C:\server\webroot\myApp\application\libraries\gas.php:133 Stack trace: #0 C:\server\webroot\myApp\application\libraries\gas.php(77): Gas->exception(Object(Error)) #1 [internal function]: Gas->{closure}(Object(Error)) #2 {main} thrown in C:\server\webroot\myApp\application\libraries\gas.php on line 133

I also tried this but it gives the same error
$u = Gas::factory('Model\User')->fill($data);

But, if I do something like the following, it works fine and the User record is successfully added.
$u = new Model\User;
$u->username = 'test user';
$u->password = 'test password';
$u->email = 'test email';

$u->save();

Any ideas please?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB