Example #1
0
 /**
  * Relation constructor.
  * @param Model $source
  * @param $attribute
  */
 public function __construct(Model $source, $attribute)
 {
     list($this->model, $this->type) = $source->getRelations()[$attribute];
     if ($this->isRel()) {
         $this->classPath = 'Afosto\\ApiClient\\Models\\' . Inflector::pluralize($this->_getModelForRel()) . '\\' . $this->model;
     } else {
         if ($this->isReference()) {
             $this->classPath = 'Afosto\\ApiClient\\Models\\' . Inflector::pluralize($this->_getModelForReference()) . '\\' . $this->_getModelForReference();
         } else {
             $this->classPath = $source->getNameSpace() . '\\' . $this->model;
         }
     }
 }