maiconpinto / cakephp-adminlte-theme

CakePHP AdminLTE Theme
http://maiconpinto.github.io/cakephp-adminlte-theme/
MIT License
174 stars 111 forks source link

Error baking template index #115

Open ZebboKlaufix opened 4 years ago

ZebboKlaufix commented 4 years ago

Hi, I'm facing two errors on baking index templates with the actual theme.

I run bin/cake bake template Roles index -f --theme AdminLTE and the template is build. But the build-process shows some notices/errors, which I'm not shure if the can be ignored safely. It happens only at the index template - the others won't show these errors:

Notice Error: Undefined index: details
In [/var/www/html/alfred/vendor/twig/twig/src/Environment.php(358) : eval()'d code, line 116]

2020-10-11 09:37:22 Notice: Notice (8): Undefined index: details in [/var/www/html/alfred/vendor/twig/twig/src/Environment.php(358) : eval()'d code, line 116]
Trace:
Cake\Error\BaseErrorHandler::handleError() - CORE/src/Error/BaseErrorHandler.php, line 188
__TwigTemplate_b05ca1eb2e8a8beb26eddcfe0430fdf7dee53da86bb9d07da30f51503e9cf2e7::doDisplay() - ROOT/vendor/twig/twig/src/Environment.php(358) : eval()'d code, line 116
Twig\Template::displayWithErrorHandling() - ROOT/vendor/twig/twig/src/Template.php, line 394
Twig\Template::display() - ROOT/vendor/twig/twig/src/Template.php, line 367
Twig\Template::render() - ROOT/vendor/twig/twig/src/Template.php, line 379
Twig\TemplateWrapper::render() - ROOT/vendor/twig/twig/src/TemplateWrapper.php, line 40
Cake\TwigView\View\TwigView::_evaluate() - ROOT/vendor/cakephp/twig-view/src/View/TwigView.php, line 300
Cake\View\View::_render() - CORE/src/View/View.php, line 1134
Bake\View\BakeView::render() - ROOT/vendor/cakephp/bake/src/View/BakeView.php, line 96
Bake\Utility\TemplateRenderer::generate() - ROOT/vendor/cakephp/bake/src/Utility/TemplateRenderer.php, line 101
Bake\Command\TemplateCommand::getContent() - ROOT/vendor/cakephp/bake/src/Command/TemplateCommand.php, line 387
Bake\Command\TemplateCommand::bake() - ROOT/vendor/cakephp/bake/src/Command/TemplateCommand.php, line 342
Bake\Command\TemplateCommand::execute() - ROOT/vendor/cakephp/bake/src/Command/TemplateCommand.php, line 126
Cake\Console\BaseCommand::run() - CORE/src/Console/BaseCommand.php, line 179
Cake\Console\CommandRunner::runCommand() - CORE/src/Console/CommandRunner.php, line 336
Cake\Console\CommandRunner::run() - CORE/src/Console/CommandRunner.php, line 171
[main] - ROOT/bin/cake.php, line 12
Warning Error: array_filter() expects parameter 2 to be a valid callback, no array or string given
In [/var/www/html/alfred/vendor/twig/twig/src/Extension/CoreExtension.php, line 1583]

2020-10-11 09:37:22 Warning: Warning (2): array_filter() expects parameter 2 to be a valid callback, no array or string given in [/var/www/html/alfred/vendor/twig/twig/src/Extension/CoreExtension.php, line 1583]
Trace:
Cake\Error\BaseErrorHandler::handleError() - CORE/src/Error/BaseErrorHandler.php, line 188
array_filter - [internal], line ??
twig_array_filter - ROOT/vendor/twig/twig/src/Extension/CoreExtension.php, line 1583
__TwigTemplate_b05ca1eb2e8a8beb26eddcfe0430fdf7dee53da86bb9d07da30f51503e9cf2e7::doDisplay() - ROOT/vendor/twig/twig/src/Environment.php(358) : eval()'d code, line 116
Twig\Template::displayWithErrorHandling() - ROOT/vendor/twig/twig/src/Template.php, line 394
Twig\Template::display() - ROOT/vendor/twig/twig/src/Template.php, line 367
Twig\Template::render() - ROOT/vendor/twig/twig/src/Template.php, line 379
Twig\TemplateWrapper::render() - ROOT/vendor/twig/twig/src/TemplateWrapper.php, line 40
Cake\TwigView\View\TwigView::_evaluate() - ROOT/vendor/cakephp/twig-view/src/View/TwigView.php, line 300
Cake\View\View::_render() - CORE/src/View/View.php, line 1134
Bake\View\BakeView::render() - ROOT/vendor/cakephp/bake/src/View/BakeView.php, line 96
Bake\Utility\TemplateRenderer::generate() - ROOT/vendor/cakephp/bake/src/Utility/TemplateRenderer.php, line 101
Bake\Command\TemplateCommand::getContent() - ROOT/vendor/cakephp/bake/src/Command/TemplateCommand.php, line 387
Bake\Command\TemplateCommand::bake() - ROOT/vendor/cakephp/bake/src/Command/TemplateCommand.php, line 342
Bake\Command\TemplateCommand::execute() - ROOT/vendor/cakephp/bake/src/Command/TemplateCommand.php, line 126
Cake\Console\BaseCommand::run() - CORE/src/Console/BaseCommand.php, line 179
Cake\Console\CommandRunner::runCommand() - CORE/src/Console/CommandRunner.php, line 336
Cake\Console\CommandRunner::run() - CORE/src/Console/CommandRunner.php, line 171
[main] - ROOT/bin/cake.php, line 12

I'm using following versions: CakePHP 4.1.4 DebugKit is loaded PHP 7.3.19-1

Thanks in advance

wash34000 commented 3 years ago

I've the same issue. Did you find the solution ?

Kind regards

jb-lj commented 2 years ago

Posting this in case someone finds this thread later. I discovered that the issue occurs only on tables with foreign key relations to another table. The fix that worked for me is to open the AssetsTable.php file from \src\Model\Table and comment out all the $this->belongsTo sections, then run the command cake bake template assets --theme AdminLTE

Then uncomment the lines in AssetsTable.php