public function __construct(BaseModel $parentModel, TransformerInterface $transformer)
 {
     $this->parentModel = $parentModel;
     if (!$this->relationName) {
         throw new \InvalidArgumentException('You must specify relationName in ' . static::class);
     }
     if (!method_exists($parentModel, $this->relationName)) {
         throw new \InvalidArgumentException('Relation ' . $this->relationName . ', required by ' . static::class . ', does not exist in ' . get_class($parentModel));
     }
     parent::__construct($transformer);
 }
Пример #2
0
 public function __construct(BaseModel $model, TransformerInterface $transformer)
 {
     $this->model = $model;
     parent::__construct($transformer);
 }