The course is built on Symfony 4, but the principles still apply perfectly to Symfony 5 - not a lot has changed in the world of relations!
// composer.json
{
"require": {
"php": "^7.1.3",
"ext-iconv": "*",
"composer/package-versions-deprecated": "^1.11", // 1.11.99
"doctrine/doctrine-bundle": "^1.6.10", // 1.10.2
"doctrine/doctrine-migrations-bundle": "^1.3|^2.0", // v2.0.0
"doctrine/orm": "^2.5.11", // v2.7.2
"knplabs/knp-markdown-bundle": "^1.7", // 1.7.0
"knplabs/knp-paginator-bundle": "^2.7", // v2.7.2
"knplabs/knp-time-bundle": "^1.8", // 1.8.0
"nexylan/slack-bundle": "^2.0,<2.2.0", // v2.0.0
"php-http/guzzle6-adapter": "^1.1", // v1.1.1
"sensio/framework-extra-bundle": "^5.1", // v5.1.4
"stof/doctrine-extensions-bundle": "^1.3", // v1.3.0
"symfony/asset": "^4.0", // v4.0.4
"symfony/console": "^4.0", // v4.0.14
"symfony/flex": "^1.0", // v1.21.6
"symfony/framework-bundle": "^4.0", // v4.0.14
"symfony/lts": "^4@dev", // dev-master
"symfony/twig-bundle": "^4.0", // v4.0.4
"symfony/web-server-bundle": "^4.0", // v4.0.4
"symfony/yaml": "^4.0", // v4.0.14
"twig/extensions": "^1.5" // v1.5.1
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0", // 3.0.2
"easycorp/easy-log-handler": "^1.0.2", // v1.0.4
"fzaninotto/faker": "^1.7", // v1.7.1
"symfony/debug-bundle": "^3.3|^4.0", // v4.0.4
"symfony/dotenv": "^4.0", // v4.0.14
"symfony/maker-bundle": "^1.0", // v1.4.0
"symfony/monolog-bundle": "^3.0", // v3.1.2
"symfony/phpunit-bridge": "^3.3|^4.0", // v4.0.4
"symfony/stopwatch": "^3.3|^4.0", // v4.0.4
"symfony/var-dumper": "^3.3|^4.0", // v4.0.4
"symfony/web-profiler-bundle": "^3.3|^4.0" // v4.0.4
}
}
5 Comments
Ola!
In line php bin/console doctrine:query:sql 'SELECT * FROM comment"
You have a liltle mistake
You forgot a ' instead " in the end of line
Cheers
hey Mike I.
Woohoo! You have a good eyes! Thanks for your attention! We fixed it, soon it will be online =)
Cheers
Nice course, one question, how I can do parent/child comments? Exp. User want to reply post.
Update comment interesting too. For give user edit it.
Thanks.
Hey Student,
For parent/children comments you need to add more mapping to Comment action, i.e. add more fields. So exactly as you said, you need to add Comment::$parent field to store parent comments and its relation will be Comment ManyToOne to Comment. And add Comment::$children so it's relation will be Comment OneToMany to Comment. So you need to self-referencing mapping.
About editing: you just need to create a Comment edit form and fill it in with data of the comment you want to edit. Of course, there should be some security check to prevent editing not yours comment :) We do not talk about forms in this course, see how to create forms: https://symfonycasts.com/sc... - but this course if on the planning stage yet. Or check out the same course but from the Symfony 3 track: https://symfonycasts.com/sc...
I hope this helps.
Cheers!
Have you had success? A code snippet would be awesome!
"Houston: no signs of life"
Start the conversation!