Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error baking template index #115

Open
ZebboKlaufix opened this issue Oct 11, 2020 · 2 comments
Open

Error baking template index #115

ZebboKlaufix opened this issue Oct 11, 2020 · 2 comments
Labels

Comments

@ZebboKlaufix
Copy link

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
Copy link

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

Kind regards

@jb-lj
Copy link

jb-lj commented Jan 28, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants