Welcome Guest, Not a member yet? Register   Sign In
DMLite ORM for CI3
#1
Heart 
(This post was last modified: 06-04-2015, 07:35 AM by Avram.)

Hello everyone!

I'm sure many of you have used DataMapper ORM (by WanWizard), but as you may have noticed, it is not being developed for a while now. Even its github/bitbucket repositores are removed and you can't download it anymore, so it's most likely dead project now Sad

Therefore, I have started working on my own ORM named "DMLite ORM" (from "DataMapper Lite"). It is in its very early stage, I've been literally working on this for the past 3-4 days only, but it already can be used in (very) simple projects. It is not (yet) thoroughly tested in a real project but I've already started making one using this ORM. I have no idea how it will behave in real world environment.

No code from the old DataMapper is used in DMLite (except the functions from the inflector helper), although I've borrowed some concepts and function names to make it as compatible as possible. My goal is to make such ORM that you can switch from CI2+DataMapper to CI3+DMLite without having to rewrite everything. But do note that this will most likely never be a drop-in replacement for the old DataMapper. At least not without help from more experienced users.

Contrary to original DataMapper which was a CodeIgniter library, this is simply extended core Model (CI_Model). Your models must extend the MY_Model class (which is the DMLite ORM class).

I have started writing documentation as a Github wiki, but as every programmer, I hate writing it. Smile Those familiar with the old DataMapper should be able to easily jump in and start using it, others will have to wait for me to write some docs (which I hope I will do in the following days).

Example of usage:

PHP Code:
<?php
/* CI controller code */

//create author
$author = new Author();
$author->name "Friedrich Nietzsche";
$author->dob 1844;
$author->save();

//create book and save it along with it's author
$book = new Book();
$book->title "Also sprach Zarathustra"  
$book
->isbn 9789562919760;
$book->year 1883;
$book->save(array($author));

?>

Again, please don't be harsh on me if something is not working (as expected) - this is very early version of the code, just a couple of days of work has been invested in this project, but I'd like to make something useful out of it.

Get it here: https://github.com/avramovic/DMLite-ORM
Reply


Messages In This Thread
DMLite ORM for CI3 - by Avram - 06-04-2015, 07:33 AM
RE: DMLite ORM for CI3 - by ivantcholakov - 06-04-2015, 08:18 AM
RE: DMLite ORM for CI3 - by Avram - 06-04-2015, 08:26 AM
RE: DMLite ORM for CI3 - by ivantcholakov - 06-04-2015, 09:03 AM
RE: DMLite ORM for CI3 - by Avram - 06-11-2015, 04:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB