Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
8 / 8
CRAP
100.00% covered (success)
100.00%
9 / 9
ORM
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
8 / 8
8
100.00% covered (success)
100.00%
9 / 9
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 repository
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 query
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 createEntity
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 repositories
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 builder
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 databaseModel
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 buildBuilder
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?php
namespace PHPixie;
class ORM
{
    protected $builder;
    
    public function __construct($database, $configSlice, $wrappers = null)
    {
        $this->builder = $this->buildBuilder($database, $configSlice, $wrappers);
    }
    
    public function repository($modelName)
    {
        return $this->databaseModel()->repository($modelName);
    }
    
    public function query($modelName)
    {
        return $this->databaseModel()->query($modelName);
    }
    
    public function createEntity($modelName, $data = null)
    {
        return $this->repository($modelName)->create($data);
    }
    
    public function repositories()
    {
        return $this->builder->repositories();
    }
    
    public function builder()
    {
        return $this->builder;
    }
    
    protected function databaseModel()
    {
        return $this->builder->models()->database();
    }
    
    protected function buildBuilder($database, $configSlice, $wrappers)
    {
        return new ORM\Builder($database, $configSlice, $wrappers);
    }
}