Allowing Methods to be set in ModelHooks

This commit is contained in:
Rob Porter
2021-04-01 15:55:14 -04:00
parent c8ebf563a0
commit 16a4297992
+11 -1
View File
@@ -749,7 +749,7 @@ class ModelsCommand extends Command
}
}
protected function setMethod($name, $type = '', $arguments = [], $comment = '')
public function setMethod($name, $type = '', $arguments = [], $comment = '')
{
$methods = array_change_key_case($this->methods, CASE_LOWER);
@@ -761,6 +761,16 @@ class ModelsCommand extends Command
}
}
public function unsetMethod($name) {
unset($this->methods[strtolower($name)]);
}
public function getMethodType(Model $model, string $classType) {
$modelName = $this->getClassNameInDestinationFile($model, get_class($model));
$builder = $this->getClassNameInDestinationFile($model, $classType);
return $builder . '|' . $modelName;
}
/**
* @param string $class
* @return string