public function __construct(Model $model, $name, $type) { $this->model = $model; $this->name = $name; $this->type = $type; if (!$model->has_attribute($name)) { $model->add_attribute(new Attribute($model, $name, $type)); } }