diff --git a/src/Gate.php b/src/Gate.php index 30465b3..cd3b689 100644 --- a/src/Gate.php +++ b/src/Gate.php @@ -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 = [];