Skip to content

Commit

Permalink
Merge pull request #8 from zunnu/4.x-dev
Browse files Browse the repository at this point in the history
Updated TableRegistry get to newer way, fixed typo in strtolower
  • Loading branch information
zunnu committed Jan 23, 2023
2 parents 53b6d63 + a546ee5 commit 0c1a58f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Gate.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ private function _associations($model, $plugin = null)
{
$associationTypes = $this->getConfig('associationTypes');

if (empty($plugin) || strtolower($plugin == 'app')) {
$setModel = TableRegistry::get($model);
if (empty($plugin) || (!empty($plugin) && strtolower($plugin) == 'app')) {
$setModel = TableRegistry::getTableLocator()->get($model);
} else {
$setModel = TableRegistry::get($plugin . '.' . $model);
$setModel = TableRegistry::getTableLocator()->get($plugin . '.' . $model);
}

$associationsArray = [];
Expand Down

1 comment on commit 0c1a58f

@asgraf
Copy link
Contributor

@asgraf asgraf commented on 0c1a58f Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not hardcode 'app' string. I suggest using Configure::read('App.namespace') instead

Please sign in to comment.