Ejemplo n.º 1
0
 /**
  * Create a fake model instance from Blueprint
  * 
  * @param Skovachev\Fakefactory\Model\Blueprint\Blueprint $blueprint 
  * @return object
  */
 protected function makeFromBlueprint($blueprint)
 {
     $modelClass = $blueprint->getClass();
     $model = $this->reflector->instantiate($modelClass);
     foreach ($blueprint->getAttributes() as $attribute) {
         $this->model->setAttribute($model, $attribute);
     }
     foreach ($blueprint->getRelations() as $relation) {
         $relation->applyToModelAndContainedValue($model);
         $this->model->setRelation($model, $relation);
     }
     $this->clearBuildOptions();
     return $model;
 }