CodeIgniter Forums
Elegant ORM - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Elegant ORM (/showthread.php?tid=59177)



Elegant ORM - El Forum - 09-02-2013

[eluser]Unknown[/eluser]
Hi,

Recently I've just developed Elegant ORM (for CodeIgniter 2.x) which is based on Laravel's Eloquent ORM. Right now it's still in beta (still in manual test and lacks of inline documentation). But more features are coming. For the latest beta version, it provides:

- Basic querying (SELECT, INSERT, UPDATE & DELETE) with beautiful and simple syntax.
- Aggregates methods
- Relationship definition (One to One, One to Many and Many to Many)
- Eager loading support

Quote:View more about Elegant ORM project on GitHub: https://github.com/nazieb/elegant-orm

Give it a try and tell me what do you think!

Thanks


Elegant ORM - El Forum - 09-02-2013

[eluser]Unknown[/eluser]
Some examples:

Defining models

Code:
class User extends Elegant\Model {
  // the name of table to work with
  protected $table = "user";
}
// That's it!

Querying

Code:
// Get all users
$users = User::all();
foreach($users as $user)
{
  echo $user->name;
}

// Find particular user(s) by its primary key
$user = User::find(1);
echo $user->name;

Creating New Model
Code:
$user =  new User;

$user->name = 'John Doe';
$user->email = '[email protected]';

$user->save();

Updating Models
Code:
$user = User::find(1);

$user->name = 'Jack Doe';
$user->save();



Elegant ORM - El Forum - 08-12-2014

[eluser]od3n[/eluser]
can i use both CI Model and Elegent ORM together?