Skip to content

Commit

Permalink
Merge pull request #28 from Nayfania/issue_34_add_docblocks
Browse files Browse the repository at this point in the history
PHPixie/Project#34 - add doc blocks for Builder.php
  • Loading branch information
dracony authored Sep 15, 2016
2 parents 95ad021 + 6e72019 commit 055259b
Showing 1 changed file with 85 additions and 17 deletions.
102 changes: 85 additions & 17 deletions src/PHPixie/ORM/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,36 @@

namespace PHPixie\ORM;

/**
* Class Builder
* @package PHPixie\ORM
*/
class Builder
{
/**
* @type \PHPixie\Database
*/
protected $database;
/**
* @var \PHPixie\Slice\Type\ArrayData
*/
protected $configSlice;
/**
* @var \PHPixie\ORM\Wrappers\Implementation|null
*/
protected $wrappers;


/**
* @var array
*/
protected $instances = array();

/**
* Builder constructor.
* @param \PHPixie\Database $database
* @param \PHPixie\Slice\Type\ArrayData $configSlice
* @param \PHPixie\ORM\Wrappers\Implementation|null $wrappers
*/
public function __construct($database, $configSlice, $wrappers = null)
{
$this->database = $database;
Expand Down Expand Up @@ -138,7 +157,11 @@ public function values()
{
return $this->instance('values');
}


/**
* @param string $name
* @return mixed
*/
protected function instance($name)
{
if(!array_key_exists($name, $this->instances)) {
Expand All @@ -148,49 +171,76 @@ protected function instance($name)

return $this->instances[$name];
}


/**
* @return Conditions
*/
protected function buildConditions()
{
return new Conditions($this);
}


/**
* @return Configs
*/
protected function buildConfigs()
{
return new Configs();
}


/**
* @return Data
*/
protected function buildData()
{
return new Data();
}


/**
* @return Database
*/
protected function buildDatabase()
{
return new Database($this->database);
}


/**
* @return Drivers
*/
protected function buildDrivers()
{
return new Drivers($this);
}


/**
* @return Loaders
*/
protected function buildLoaders()
{
return new Loaders($this);
}


/**
* @return Mappers
*/
protected function buildMappers()
{
return new Mappers($this);
}


/**
* @return Maps
*/
protected function buildMaps() {
return new Maps(
$this,
$this->configSlice->slice('relationships')
);
}


/**
* @return Models
*/
protected function buildModels()
{
return new Models(
Expand All @@ -199,32 +249,50 @@ protected function buildModels()
$this->wrappers
);
}


/**
* @return Planners
*/
protected function buildPlanners()
{
return new Planners($this);
}


/**
* @return Plans
*/
protected function buildPlans()
{
return new Plans();
}


/**
* @return Relationships
*/
protected function buildRelationships()
{
return new Relationships($this);
}


/**
* @return Repositories
*/
protected function buildRepositories()
{
return new Repositories($this->models());
}


/**
* @return Steps
*/
protected function buildSteps()
{
return new Steps($this);
}


/**
* @return Values
*/
protected function buildValues()
{
return new Values();
Expand Down

0 comments on commit 055259b

Please sign in to comment.