Welcome Guest, Not a member yet? Register   Sign In
DMZ Issues
#1

[eluser]Unknown[/eluser]
I seem to have trouble getting DMZ to work. Either I'm missing something obvious, or I'm just plain doing it wrong. I can't seem to get relationships to work. The tables don't join. What am I doing wrong here?

Datamapper Config (config/datamapper.php)
Code:
$config['auto_populate_has_many'] = TRUE;
$config['auto_populate_has_one'] = TRUE;

Blog Controller (controllers/blog.php)
Code:
public function index()
    {
        $latest = new Article();
        $latest->get();
        
        print_r($latest->all);
        
        $this->output->enable_profiler(TRUE);
        
    }

Articles Model (models/article.php)
Code:
class Article extends DataMapper
{
    public $table = 'articles';
    
    public $has_one = array('author');

    public function __construct($id = NULL)
    {
        parent::__construct($id);
    }
}

Author Model (models/author.php)
Code:
class Author extends DataMapper
{
    public $table = 'authors';

    public $has_many = array('article');
    
    public function __construct($id = NULL)
    {
        parent::__construct($id);
    }
    
}

Profiler Output
Code:
DATABASE:  personal   QUERIES: 2  
0.0129      SELECT * FROM `ci_articles` LIMIT 1
0.0011      SELECT * FROM (`ci_articles`)


Messages In This Thread
DMZ Issues - by El Forum - 01-30-2010, 11:43 PM
DMZ Issues - by El Forum - 01-31-2010, 01:25 AM
DMZ Issues - by El Forum - 03-26-2010, 01:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB