CodeIgniter Forums
Outlet ORM - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Libraries & Helpers (
+--- Thread: Outlet ORM (/thread-12803.html)

Pages: 1 2

Outlet ORM - El Forum - 10-31-2008

Hy guys,

I've been using this really cool ORM library called Outlet and I'd like to share how I managed to integrate it on CI. Since it is my first contribution to the community, just let me know if I'm doing anything wrong or forgetting something here.
Since english is not my native language, sorry about any incorrect use of words or mispelling.


Here is the site and documentation. For this post, I'm going to assume that you've created your models and config file needed to get the libray working.

This is the folder structure I built:
    - outlet-config.php

    - models_include.php // file to include models
    - ... models ...

    - ... library files ...

    - MY_Loader.php // Extends CI loader and adds a new method to load Outlet

To load the library, I extended CI loader and added this method
class MY_Loader
    function outlet()
        static $loaded = false;
        if ($loaded) return;
        // Includes models
        include_once APPPATH.'/models/models_include.php';
        // Sets outlet include path
        ini_set('include_path', ini_get('include_path').';'.realpath(APPPATH.'/outlet'));
        require_once 'Outlet.php';
        Outlet::init(include APPPATH.'/config/outlet-config.php');
        $outlet = Outlet::getInstance();
        $loaded = true;

And to avoid name conflicts, I did a small change to the /system/codeigniter/CodeIgniter.php so that all controllers will need the 'Controller' suffix
* ------------------------------------------------------
*  Security check
* ------------------------------------------------------
*  ...
$class  = $RTR->fetch_class().'Controller'; // Here is the change
$method = $RTR->fetch_method();

if ( ! class_exists($class)
    OR $method == 'controller'

I did that so that I can have a Order entity, an OrderController and still use a clean URL /index.php/order without any change to the CI core

I'm actually using the repository pattern but to make things simple, here's a sample usage:
class OrderController extends Controller
    function show($id)
        $outlet = Outlet::getInstance();
        $order = $outlet->load('Order', $id);
        // display order data...

The 'models_include.php' file is really simple:
* Include all models

require_once 'Order.php';
require_once 'OrderLine.php';
// ... other entities ...

I hope you guys like it

Fábio Rehm

Outlet ORM - El Forum - 11-03-2008

For those using HMVC you have to modify the Loader inside the Controller.php file.

See ya,
Fábio Rehm

Outlet ORM - El Forum - 03-12-2009

What is your experience with this ORM?

Is it stable enough for production environments?

Any significant performance issues?

many thanks for sharing your solution

Outlet ORM - El Forum - 03-13-2009

Hi acpbl,

I haven't used it on production enviroments yet but I'm about to launch an intranet that uses it.
I'm currently helping the library development and I can say that the main developer (Alvaro Carrasco) has been using it on production.

The thing to watch out for is changes to the API, since it hasn't reached 1.0 it is still evolving.

Feel free to test the library and join us on Google Groups if you have any other questions.
Fabio Rehm

Outlet ORM - El Forum - 04-22-2009

Hi Guys,

I'm just dropping by to say that the 0.7 version of the library was released.

These are the new features:
* One-to-one and many-to-many relationships
* PHP-5.2's DateTime support
* Fluent-interface query API
* Eager-fetching
* PostgreSQL support

Check it out:

Fabio Rehm

Outlet ORM - El Forum - 10-28-2009

[eluser]louis w[/eluser]
This looks very interesting.

I also have to say I like your change to codeigniter.php to force controllers to end in Controller while not indicating this in the url. This would be a great permanent change.

Outlet ORM - El Forum - 10-29-2009

I'm glad that you've liked it :-)

We've been working on the 2.0 version on Github, there are some cool new features like Unit of Work and proxy caching. Just keep in mind that it is on a really early stage and it need to implement some features that we currently support on 0.7:

If you have any questions you can drop by our group:

Fábio Rehm

Outlet ORM - El Forum - 11-17-2009

[eluser]Bjørn Børresen[/eluser]
This looks very interesting. It seems pretty similar to Doctrine though, how does it compare? From the docs it seems it handles relationships nicely :-)

Outlet ORM - El Forum - 11-17-2009

[eluser]Bjørn Børresen[/eluser]
Ok, just a little update, fgrehm answered my question on Twitter:

* well, Doctrine < 2.0 is more like activerecord pattern and outlet like data mappers
* doctrine has more features than outlet but that actually makes us easier to use and give us better performance (never measured)
* and doctrine 2.0 query language is a lot verbose, they require u to use fully qualified class names, outlet supports aliasing
* aliasing stuff relates to outlet 2.0 version still being developed on

Outlet ORM - El Forum - 11-17-2009

I like the fact that Outlet doesn't require your objects to be extended.

Also for being lightweight, it sure is faster than Doctrine?