Skip to content

Commit

Permalink
Merge pull request #220 from cakephp/fetchTable
Browse files Browse the repository at this point in the history
Avoid using deprecated method.
  • Loading branch information
markstory committed Dec 26, 2022
2 parents 60e5f51 + 665f5f9 commit 230ff0d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 1 addition & 7 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.x-dev@">
<file src="src/Controller/Component/AuthorizationComponent.php">
<DeprecatedMethod occurrences="1">
<code>loadModel</code>
</DeprecatedMethod>
</file>
</files>
<files psalm-version="4.x-dev@"/>
3 changes: 2 additions & 1 deletion src/Controller/Component/AuthorizationComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ public function authorizeAction(): void

$authorizeModel = $this->checkAction($action, 'authorizeModel');
if ($authorizeModel) {
$this->authorize($this->getController()->loadModel());
$method = method_exists($this->getController(), 'fetchTable') ? 'fetchTable' : 'loadModel';
$this->authorize($this->getController()->{$method}());
}
}

Expand Down

0 comments on commit 230ff0d

Please sign in to comment.