diff --git a/src/PHPixie/ORM/Builder.php b/src/PHPixie/ORM/Builder.php index 657c71d8..36439b4b 100755 --- a/src/PHPixie/ORM/Builder.php +++ b/src/PHPixie/ORM/Builder.php @@ -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; @@ -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)) { @@ -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( @@ -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();