Part of the EllisLab Network
   
2 of 2
2
Outlet ORM
Posted: 18 November 2009 03:47 AM   [ Ignore ]   [ # 11 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  350
Joined  08-29-2008

How does this compare to Datamapper OverZelous edition?

 Signature 

421 Entertainment :: YAAS - Yet Another Authentication System :: Error Logger :: DB Configs

Profile
 
 
Posted: 25 November 2009 03:16 PM   [ Ignore ]   [ # 12 ]  
Grad Student
Avatar
Rank
Total Posts:  73
Joined  04-04-2007
fgrehm - 31 October 2008 06:42 PM

I’m actually using the repository pattern but to make things simple, here’s a sample usage:

class OrderController extends Controller
{
    
function show($id)
    
{
        $this
->load->outlet();
        
        
$outlet Outlet::getInstance();
        
$order $outlet->load('Order'$id);
        
// display order data...
    
}

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

 Signature 

Programming is both a science and an art.
——
http://twitter.com/MarcoBarbosa
http://marcobarbosa.com

Profile
 
 
Posted: 08 July 2010 10:37 PM   [ Ignore ]   [ # 13 ]  
Summer Student
Avatar
Total Posts:  1
Joined  08-28-2007
M4rc0 - 25 November 2009 08:16 PM

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

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. 

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;
     
}
Profile
 
 
   
2 of 2
2