This tutorial is built using Symfony 4, but most of the concepts apply fine to Symfony 5!
// composer.json
{
"require": {
"php": "^7.1.3",
"ext-iconv": "*",
"doctrine/annotations": "^1.8", // v1.8.0
"knplabs/knp-markdown-bundle": "^1.7", // 1.7.0
"knpuniversity/lorem-ipsum-bundle": "*@dev", // dev-master
"nexylan/slack-bundle": "^2.0,<2.2", // v2.0.1
"php-http/guzzle6-adapter": "^1.1", // v1.1.1
"sensio/framework-extra-bundle": "^5.1", // v5.1.6
"symfony/asset": "^4.0", // v4.0.6
"symfony/console": "^4.0", // v4.0.6
"symfony/flex": "^1.0", // v1.21.6
"symfony/framework-bundle": "^4.0", // v4.0.6
"symfony/lts": "^4@dev", // dev-master
"symfony/twig-bundle": "^4.0", // v4.0.6
"symfony/web-server-bundle": "^4.0", // v4.0.6
"symfony/yaml": "^4.0", // v4.0.6
"weaverryan_test/lorem-ipsum-bundle": "^1.0" // v1.0.0
},
"require-dev": {
"easycorp/easy-log-handler": "^1.0.2", // v1.0.4
"sensiolabs/security-checker": "^4.1", // v4.1.8
"symfony/debug-bundle": "^3.3|^4.0", // v4.0.6
"symfony/dotenv": "^4.0", // v4.0.6
"symfony/maker-bundle": "^1.0", // v1.1.1
"symfony/monolog-bundle": "^3.0", // v3.2.0
"symfony/phpunit-bridge": "^3.3|^4.0", // v4.3.3
"symfony/stopwatch": "^3.3|^4.0", // v4.0.6
"symfony/var-dumper": "^3.3|^4.0", // v4.0.6
"symfony/web-profiler-bundle": "^3.3|^4.0" // v4.0.6
}
}
6 Comments
At the end of the script :
CustomUserProvider ? I missed something ?
Hey Capucine,
Not really, it's just a misprint :) Thanks for pointing this, I fixed it in https://github.com/knpunive...
Cheers!
One more comment:
If you implement the Interface in your CustomWordProvider,
$words = parent::getWordList();does not work longer because not extending a Service wich is the parent.Hey Maik T.!
That's correct :). This is really up to the user at this point - they can choose to make their
CustomWordProvidercontinue to extendKnpUWordProvideror only implement the interface. But yea, then they wouldn't be able to call the parent function :). If you didn't want to extend the internal class, the user could use "service decoration". That allows you to fetch the KnpUWordProvider "words" without extending the class - the most pure solution for whoever is implementing your bundle - https://symfonycasts.com/screencast/api-platform-security/service-decoration#service-declaration-amp-decorationCheers!
There is a logical Error in the script:
If you remove the Custom word Provider and refresh the site you will get a ServiceNotFoundException because the Interface is included but no Service is really set.
To fix it you can still fix it simply in the Extension class by changing following code:
`
`
Hey Maik T.!
Hmm. Are you sure that's needed? The part you added was the "else", correct? That alias was already added in the services.xml file - https://symfonycasts.com/sc...
Or am I missing something? It's totally possible :).
Cheers!
"Houston: no signs of life"
Start the conversation!