You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an abstract controller class (named other than "AppController"), and this leads to an exception when running bin/cake acl_extras aco_sync:
Exception: Cannot instantiate abstract class App\Controller\MyAbstractController in
[/apppath/vendor/cakephp/acl/src/AclExtras.php, line 433]
It looks as a closely related issue was addressed almost two years ago in 6106e51, but then that fix was reverted several days later, in 655b1e3.
I'm not clear if there's a good reason the original fix was reverted, such as undesirable behaviour elsewhere in the plugin, or if it was a regression. Or am I just using the plugin incorrectly, e.g. missing a configuration option or something, and my abstract controller shouldn't be a problem?
It looks as if the problem, at least as I'm experiencing it, can be solved by ignoring abstract controller classes entirely. For example, by checking whether $controller is abstract in _updateControllers and skipping over it when it is, at the same point that a $controllerName of 'App' is skipped. Something like this in:
// existing check
if ($controllerName == 'App') {
continue;
}
// new check
$namespace = $this->_getNamespace($controller, $pluginPath, $prefix);
if ((new \ReflectionClass($namespace))->isAbstract()) {
continue;
}
If this is a bug and that fix seems appropriate, then I can submit a PR for it.
The text was updated successfully, but these errors were encountered:
I have an abstract controller class (named other than "AppController"), and this leads to an exception when running
bin/cake acl_extras aco_sync
:It looks as a closely related issue was addressed almost two years ago in 6106e51, but then that fix was reverted several days later, in 655b1e3.
I'm not clear if there's a good reason the original fix was reverted, such as undesirable behaviour elsewhere in the plugin, or if it was a regression. Or am I just using the plugin incorrectly, e.g. missing a configuration option or something, and my abstract controller shouldn't be a problem?
It looks as if the problem, at least as I'm experiencing it, can be solved by ignoring abstract controller classes entirely. For example, by checking whether
$controller
is abstract in_updateControllers
and skipping over it when it is, at the same point that a$controllerName
of'App'
is skipped. Something like this in:If this is a bug and that fix seems appropriate, then I can submit a PR for it.
The text was updated successfully, but these errors were encountered: