Welcome Guest, Not a member yet? Register   Sign In
Outlet ORM
#11

[eluser]fgrehm[/eluser]
@bjornbjorn
Thanks for posting my reply here Big Grin

@M4rc0
I can't tell you 100% that it is faster and how faster it is. The fact that we use plain PDO and that we are not using reflection makes me believe in it. I know that have a PECL extension that does the hydration using C code but I've never tried it.

If anyone is interested in doing this benchmark don't forget to show us the results Big Grin

Regards,
--
Fábio Rehm
#12

[eluser]tdktank59[/eluser]
How does this compare to Datamapper OverZelous edition?
#13

[eluser]M4rc0[/eluser]
[quote author="fgrehm" date="1225496579"]
I'm actually using the repository pattern but to make things simple, here's a sample usage:
Code:
class OrderController extends Controller
{
    function show($id)
    {
        $this->load->outlet();
        
        $outlet = Outlet::getInstance();
        $order = $outlet->load('Order', $id);
        // display order data...
    }
}
[/quote]

Hi (Olá) Fábio,

Could you elaborate your example a little bit further?

You gave a great introduction to Outlet, and that is the problem because I'm more interested now (also searching for an ORM) Smile

How would the model look like in this "repository" pattern? Is this the same as a "Domain Driven Design" pattern?

I'm just trying to imagine the model after you presented the controller Smile
#14

[eluser]Unknown[/eluser]
[quote author="M4rc0" date="1259198194"]

How would the model look like in this "repository" pattern? Is this the same as a "Domain Driven Design" pattern?

I'm just trying to imagine the model after you presented the controller Smile[/quote]

This is how I would do it. I was taught that all DB calls are done in the model. The controller and views should not have to request anything from the DB. Might not be the best way, but it works for me.

Code:
class OrderController extends Controller
{
    function show($id)
    {
  
        // display order data...
        $data['order'] = $this->order_model->getOrderById($id);
        $this->load->view('showOrder', $data);
    }
}

// in the model file Order_model.php
class order_model extends Model
{
     function getOrderById($id)
     {
        $this->load->outlet();
        
        $outlet = Outlet::getInstance();
        $order = $outlet->load('Order', $id);
        
        // Normally, I'd validate to make sure I have something to return
        return $order;
     }
}




Theme © iAndrew 2016 - Forum software by © MyBB