Closed tyler36 closed 2 years ago
Is this ready now with ddev v1.19?
There are issues with (
& )
but i suspect that relates back to https://github.com/drud/ddev/pull/3603
$ ddev tinker node_access_rebuild()
\bash: syntax error near unexpected token `('
$ ddev tinker 'node_access_rebuild()'
bash: -c: line 1: syntax error near unexpected token `('
bash: -c: line 1: `set -eu && ( /mnt/ddev_config/.global_commands/web/tinker node_access_rebuild())'
$ ddev tinker "node_access_rebuild()"
bash: -c: line 1: syntax error near unexpected token `('
bash: -c: line 1: `set -eu && ( /mnt/ddev_config/.global_commands/web/tinker node_access_rebuild())'
$ ddev tinker '"node_access_rebuild()"'
[notice] Message: Content permissions have been rebuilt.
$ ddev tinker "'node_access_rebuild()'"
[notice] Message: Content permissions have been rebuilt.
$ ddev tinker 'node_access_rebuild\(\)'
[notice] Message: Content permissions have been rebuilt.
There are notes under the "laravel" section with examples.
This PR is still valid though since it still does add 2 features:
yes ... it's good to go.
Just been playing around with the command.
TLDR:
'
; "
works too, sometimes ❯ ddev tinker 6+5
11
❯ ddev tinker User::find(1)
[!] Aliasing 'User' to 'App\Models\User' for this Tinker session.
Psy\Exception\FatalErrorException
PHP Fatal error: Class constant 'User::find' not found in eval()'d code on line 1
at :1
➜ 1▕
❯ ddev tinker 'User::find(1)'
[!] Aliasing 'User' to 'App\Models\User' for this Tinker session.
App\Models\User^ {#4271
...
❯ ddev tinker "User::find(1)"
[!] Aliasing 'User' to 'App\Models\User' for this Tinker session.
App\Models\User^ {#4271
...
❯ ddev tinker 'node_access_rebuild()'
[notice] Message: Content permissions have been rebuilt.
❯ ddev tinker "$node = \Drupal\node\Entity\Node::load(1); print $node->getTitle();"
[error] ParseError: syntax error, unexpected token "=", expecting end of file in Drush\Commands\core\PhpCommands->evaluate() (line 1 of /var/www/html/vendor/drush/drush/src/Commands/core/PhpCommands.php(30) : eval()'d code) #0 [internal function]: Drush\Commands\core\PhpCommands->evaluate(' = \\Drupal\\node...', Array)
❯ ddev tinker '$node = \Drupal\node\Entity\Node::load(1); print $node->getTitle();'
Who Doesn’t Like a Good Waterfall?
$ ddev tinker 6+5
11
$ ddev tinker User::find(1)
-bash: syntax error near unexpected token `('
$ ddev tinker 'User::find(1)'
[!] Aliasing 'User' to 'App\Models\User' for this Tinker session.
App\Models\User^ {#4647
...
$ ddev tinker "User::find(1)"
[!] Aliasing 'User' to 'App\Models\User' for this Tinker session.
App\Models\User^ {#4647
...
$ ddev tinker 'node_access_rebuild()'
[notice] Message: Content permissions have been rebuilt.
$ ddev tinker "node_access_rebuild()"
[notice] Message: Content permissions have been rebuilt.
$ ddev tinker "$node = \Drupal\node\Entity\Node::load(1); print $node->getTitle();"
[error] ParseError: syntax error, unexpected token "=", expecting end of file in Drush\Commands\core\PhpCommands->evaluate() (line 1 of /var/www/html/vendor/drush/drush/src/Commands/core/PhpCommands.php(30)
$ ddev tinker '$node = \Drupal\node\Entity\Node::load(1); print $node->getTitle();'
Who Doesn’t Like a Good Waterfall?
When you do ddev tinker "$node = \Drupal\node\Entity\Node::load(1); print $node->getTitle();"
bash is turning \D
into a control character before ever using it...
If you're happy with it i'll pull it.
I am happy with it. The readme has example of usage and it is an improvement over the current version. Thank you.
How this PR Solves The Problem:
Drupal10
supportCurrently, there are issues with quotes and working with bash. There are some documented workaround in this command but they are not idea.
https://github.com/drud/ddev/pull/3603 opens up the possibility of support so this is kinda premptive and offers another real-world case for testing and support.
Ideally, we should be able to run the examples on the Drush php:eval page:
Manual Testing Instructions:
Related Issue Link(s):
https://github.com/drud/ddev/pull/3603