Skip to content

Update doctrine.rst #9111

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

Merged
merged 2 commits into from
Jan 24, 2018
Merged

Update doctrine.rst #9111

merged 2 commits into from
Jan 24, 2018

Conversation

workschan
Copy link
Contributor

No description provided.

@javiereguiluz
Copy link
Member

@workschan is there really a problem for using single quotes? I've just tested it in the Symfony Demo app and it works:

$ php bin/console doctrine:query:sql 'SELECT * FROM symfony_demo_user'

array(3) {
  [0]=>
  array(6) {
    ["id"]=>
    string(1) "1"
    ["full_name"]=>
    string(8) "Jane Doe"
    ["username"]=>
    string(10) "jane_admin"
    ["email"]=> "..."

@xabbuh xabbuh added this to the 2.7 milestone Jan 23, 2018
@marek-pietrzak-tg
Copy link
Contributor

I think we should leave the docs as they are now with single quotes.
For given example double quotes don't give any harm, but following that convention if someone tries to run a query with backticks, will get bash error.

Example:

php bin/console doctrine:query:sql "SELECT * FROM `symfony_demo_user`"

returns:

bash: symfony_demo_user: command not found

but using single quote is fine:

php bin/console doctrine:query:sql 'SELECT * FROM `symfony_demo_user`'

@javiereguiluz
Copy link
Member

The arguments provided by @mheki are pretty convincing, so let's close as "won't merge". I'm sorry @workschan ... but we are looking forward to further contributions from you. Thanks!

@workschan
Copy link
Contributor Author

workschan commented Jan 23, 2018

@javiereguiluz I run this command in Windows cmd, then return:
Error thrown while running command "doctrine:query:sql "'SELECT" "*" FROM "product'"". Message: "Too many arguments, expected arguments "command" "sql"."

Too many arguments, expected arguments "command" "sql".

use double quotes fix it.

@workschan workschan deleted the patch-1 branch January 23, 2018 16:10
@javiereguiluz
Copy link
Member

I'm going to reopen to see if other people can explain to us if this is a Windows thing or a Doctrine thing. Thanks.

@workschan workschan restored the patch-1 branch January 23, 2018 16:11
@workschan workschan deleted the patch-1 branch January 23, 2018 16:15
@workschan workschan restored the patch-1 branch January 23, 2018 16:16
@marek-pietrzak-tg
Copy link
Contributor

@workschan Could you paste here how exactly you run the command on Windows, please?

@workschan
Copy link
Contributor Author

Just run the example command of docs on Windows cmd:
php bin/console doctrine:query:sql 'SELECT * FROM product'

@marek-pietrzak-tg
Copy link
Contributor

thanks @workschan that's really interesting.
@javiereguiluz I made a little bit of investigation on Windows 10:

  • running commands in Powershell is fine in both ways
  • running commands in command prompt (cmd.exe) works only with " double quotes as @workschan mentioned.

@xabbuh xabbuh reopened this Jan 24, 2018
@javiereguiluz
Copy link
Member

Marek, thanks for investigating this issue. I've reworded the contents to mention this. Thanks!

@workschan
Copy link
Contributor Author

workschan commented Jan 24, 2018

@javiereguiluz That should change commands source code to match single quotes and double quotes.

@xabbuh
Copy link
Member

xabbuh commented Jan 24, 2018

Is this the only place where such a change is necessary?

@javiereguiluz
Copy link
Member

@xabbuh I've looked for and it's the only occurrence in this article and also in the entire docs (at least on 4.0 branch).

@javiereguiluz
Copy link
Member

@workschan it's now merged. Thanks for helping us spot this problem.

@javiereguiluz javiereguiluz merged commit 4f18a5a into symfony:4.0 Jan 24, 2018
javiereguiluz added a commit that referenced this pull request Jan 24, 2018
This PR was merged into the 4.0 branch.

Discussion
----------

Update doctrine.rst

Commits
-------

4f18a5a Add a note about running Doctrine commands on Windows
c9c049f Update doctrine.rst
@xabbuh xabbuh modified the milestones: 2.7, 4.0 Jan 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants