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

Exception: Unknown "as_array" in cake console #391

Closed
ADmad opened this Issue Dec 10, 2017 · 5 comments

Comments

Projects
None yet
4 participants
@ADmad
Member

ADmad commented Dec 10, 2017

From @squalltua on December 10, 2017 3:37

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • CakePHP Version: 3.5.7

  • Platform and Target: Apache 2, MySQL, PHP 7.0.22

What you did

Used bin/cake bake model Users

What happened

Got error about:

ubuntu@ubuntu-xenial:/var/www/html$ bin/cake bake model Users
One moment while associations are detected.
Exception: Unknown "as_array" filter in "/vagrant/vendor/cakephp/bake/src/Template/Bake/Model/table.twig" at line 50. in [/vagrant/vendor/twig/twig/lib/Twig/ExpressionParser.php, line 695]
2017-12-10 03:33:21 Error: [Twig_Error_Syntax] Unknown "as_array" filter in "/vagrant/vendor/cakephp/bake/src/Template/Bake/Model/table.twig" at line 50. in /vagrant/vendor/twig/twig/lib/Twig/ExpressionParser.php on line 695
Stack Trace:
#0 /vagrant/vendor/twig/twig/lib/Twig/ExpressionParser.php(481): Twig_ExpressionParser->getFilterNodeClass('as_array', 50)
#1 /vagrant/vendor/twig/twig/lib/Twig/ExpressionParser.php(466): Twig_ExpressionParser->parseFilterExpressionRaw(Object(Twig_Node_Expression_Name))
#2 /vagrant/vendor/twig/twig/lib/Twig/ExpressionParser.php(320): Twig_ExpressionParser->parseFilterExpression(Object(Twig_Node_Expression_Name))
#3 /vagrant/vendor/twig/twig/lib/Twig/ExpressionParser.php(212): Twig_ExpressionParser->parsePostfixExpression(Object(Twig_Node_Expression_Name))
#4 /vagrant/vendor/twig/twig/lib/Twig/ExpressionParser.php(102): Twig_ExpressionParser->parsePrimaryExpression()
#5 /vagrant/vendor/twig/twig/lib/Twig/ExpressionParser.php(55): Twig_ExpressionParser->getPrimary()
#6 /vagrant/vendor/twig/twig/lib/Twig/Parser.php(147): Twig_ExpressionParser->parseExpression()
#7 /vagrant/vendor/twig/twig/lib/Twig/TokenParser/If.php(45): Twig_Parser->subparse(Array)
#8 /vagrant/vendor/twig/twig/lib/Twig/Parser.php(190): Twig_TokenParser_If->parse(Object(Twig_Token))
#9 /vagrant/vendor/twig/twig/lib/Twig/TokenParser/If.php(36): Twig_Parser->subparse(Array)
#10 /vagrant/vendor/twig/twig/lib/Twig/Parser.php(190): Twig_TokenParser_If->parse(Object(Twig_Token))
#11 /vagrant/vendor/twig/twig/lib/Twig/Parser.php(103): Twig_Parser->subparse(NULL, false)
#12 /vagrant/vendor/twig/twig/lib/Twig/Environment.php(712): Twig_Parser->parse(Object(Twig_TokenStream))
#13 /vagrant/vendor/twig/twig/lib/Twig/Environment.php(770): Twig_Environment->parse(Object(Twig_TokenStream))
#14 /vagrant/vendor/twig/twig/lib/Twig/Environment.php(452): Twig_Environment->compileSource(Object(Twig_Source))
#15 /vagrant/vendor/wyrihaximus/twig-view/src/View/TwigView.php(180): Twig_Environment->loadTemplate('/vagrant/vendor...')
#16 /vagrant/vendor/cakephp/bake/src/View/BakeView.php(146): WyriHaximus\TwigView\View\TwigView->_render('/vagrant/vendor...')
#17 /vagrant/vendor/cakephp/bake/src/Shell/Task/BakeTemplateTask.php(89): Bake\View\BakeView->render('Model/table')
#18 /vagrant/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(956): Bake\Shell\Task\BakeTemplateTask->generate('Model/table')
#19 /vagrant/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(114): Bake\Shell\Task\ModelTask->bakeTable(Object(Cake\ORM\Table), Array)
#20 /vagrant/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(100): Bake\Shell\Task\ModelTask->bake('Users')
#21 /vagrant/vendor/cakephp/cakephp/src/Console/Shell.php(507): Bake\Shell\Task\ModelTask->main('Users')
#22 /vagrant/vendor/cakephp/cakephp/src/Console/Shell.php(500): Cake\Console\Shell->runCommand(Array, false, Array)
#23 /vagrant/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(230): Cake\Console\Shell->runCommand(Array, true, Array)
#24 /vagrant/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(182): Cake\Console\ShellDispatcher->_dispatch(Array)
#25 /vagrant/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(128): Cake\Console\ShellDispatcher->dispatch(Array)
#26 /vagrant/bin/cake.php(34): Cake\Console\ShellDispatcher::run(Array)
#27 {main}

What you expected to happen

I think because source form composer
when i manual download zip file. it work

P.S. Remember, an issue is not the place to ask questions. You can use Stack Overflow
for that or join the #cakephp channel on irc.freenode.net, where we will be more
than happy to help answer your questions.

Before you open an issue, please check if a similar issue already exists or has been closed before.

Copied from original issue: cakephp/cakephp#11523

@ADmad ADmad added the Defect label Dec 10, 2017

@ADmad ADmad referenced this issue Dec 10, 2017

Closed

Exception: Unknown "as_array" in cake console #11523

1 of 3 tasks complete

@markstory markstory added this to the 1.5.x milestone Dec 10, 2017

@ADmad

This comment has been minimized.

Show comment
Hide comment
@ADmad

ADmad Dec 10, 2017

Member

Sounds related to #381

Member

ADmad commented Dec 10, 2017

Sounds related to #381

@markstory markstory modified the milestones: 1.5.x, 1.6.x Dec 29, 2017

@Jonatanmdez

This comment has been minimized.

Show comment
Hide comment
@Jonatanmdez

Jonatanmdez Jan 18, 2018

Is the same bug yes, I have both.

I need to have in mi bootstrap.php

Plugin::load('WyriHaximus/TwigView', ['bootstrap' => true]);

Jonatanmdez commented Jan 18, 2018

Is the same bug yes, I have both.

I need to have in mi bootstrap.php

Plugin::load('WyriHaximus/TwigView', ['bootstrap' => true]);
@dereuromark

This comment has been minimized.

Show comment
Hide comment
@dereuromark

dereuromark Feb 23, 2018

Member

Interesting.
So requiring Bake is not enough, we either manually need to require the other plugin - or we need some auto-chaining (similar to require).

Member

dereuromark commented Feb 23, 2018

Interesting.
So requiring Bake is not enough, we either manually need to require the other plugin - or we need some auto-chaining (similar to require).

@dereuromark dereuromark referenced this issue Feb 23, 2018

Closed

RFC - Plugin Classes #11687

1 of 3 tasks complete
@dereuromark

This comment has been minimized.

Show comment
Hide comment
@dereuromark

dereuromark Feb 23, 2018

Member

Turns out ( #381 (comment) ) that Plugin::loadAll() without also requiring the bootstrap breaks.
So best to either not load theTwig plugin at all, or make sure the bootstrap is loaded.

Member

dereuromark commented Feb 23, 2018

Turns out ( #381 (comment) ) that Plugin::loadAll() without also requiring the bootstrap breaks.
So best to either not load theTwig plugin at all, or make sure the bootstrap is loaded.

@ADmad

This comment has been minimized.

Show comment
Hide comment
@ADmad

ADmad Feb 23, 2018

Member

Closing as the docs have been updated clarifying how to ensure that TwigView's bootstrap is loaded.

Member

ADmad commented Feb 23, 2018

Closing as the docs have been updated clarifying how to ensure that TwigView's bootstrap is loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment