Skip to content

Commit 16a4297

Browse files
author
Rob Porter
committed
Allowing Methods to be set in ModelHooks
1 parent c8ebf56 commit 16a4297

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Console/ModelsCommand.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ public function setProperty($name, $type = null, $read = null, $write = null, $c
749749
}
750750
}
751751

752-
protected function setMethod($name, $type = '', $arguments = [], $comment = '')
752+
public function setMethod($name, $type = '', $arguments = [], $comment = '')
753753
{
754754
$methods = array_change_key_case($this->methods, CASE_LOWER);
755755

@@ -761,6 +761,16 @@ protected function setMethod($name, $type = '', $arguments = [], $comment = '')
761761
}
762762
}
763763

764+
public function unsetMethod($name) {
765+
unset($this->methods[strtolower($name)]);
766+
}
767+
768+
public function getMethodType(Model $model, string $classType) {
769+
$modelName = $this->getClassNameInDestinationFile($model, get_class($model));
770+
$builder = $this->getClassNameInDestinationFile($model, $classType);
771+
return $builder . '|' . $modelName;
772+
}
773+
764774
/**
765775
* @param string $class
766776
* @return string

0 commit comments

Comments
 (0)