Skip to content

Commit

Permalink
fix behavior to work without rest model
Browse files Browse the repository at this point in the history
  • Loading branch information
jturbide committed Feb 24, 2024
1 parent ce58b9a commit ee6dac5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Mvc/Controller/Behavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ public function beforeExecuteRoute(Dispatcher $dispatcher): void
if (is_int($className) || get_class($this) === $className) {
$this->attachBehaviors($behaviors, 'rest');
}
if ($this->getModelClassName() === $className) {
$this->attachBehaviors($behaviors, 'model');
if (method_exists($this, 'getModelClassName')) {
if ($this->getModelClassName() === $className) {
$this->attachBehaviors($behaviors, 'model');
}
}
}
}
Expand Down

0 comments on commit ee6dac5

Please sign in to comment.