Aim:
We are going to build a Slim application that creates a farm pen and outputs the noises that the cow & chicken inside the pen make.
Requ...
For further actions, you may consider blocking this person and/or reporting abuse
I have the error message
"Entry \"Farm\\Controllers\\PenController\" cannot be resolved: Parameter $container of __construct() has no value defined or guessable\nFull definition:\nObject (\n class = Farm\\Controllers\\PenController\n lazy = false\n __construct(\n $container = #UNDEFINED#\n )\n)"
and think it might be due to this: "In contrast with Slim 2 and Slim 3, Slim 4 does not ship with a DI container, but instead, supports any PSR-11 compatibly DI container that you provide." (akrabat.com/dependency-injection-i...)But since I am a total noob it could also be another problem. :)
The problem was, that the parameter that gets passed to the constructor is tested for its type by slim. So we have to type-hint it now with "Container". But this is just one of the problems this tutorial raises when applied to Slim 4.
I like this tutorial very much for getting a basic grasp on what is going on. But there is no
src/dependencies.php
(also nodependAncies.php
). Is this due to a new version of slim? How can we proceed anyway? Thanks a lot!EDIT: I tried it anyway (creating a depandencies.php and putting in that single line) and got the following error that I do not understand since this file exists:
Uncaught Error: Class 'App\Application\Handlers\HttpErrorHandler
packagist.org/packages/slim/slim-s...
According to the time the article was published, this version has this file;
this commend:
composer create-project slim/slim-skeleton slimFarm 3.1.5
Getting the following error:
{
"statusCode": 500,
"error": {
"type": "SERVER_ERROR",
"description": "Call to undefined method Farm\Factories\PenModelFactory::getCowNoise()"
}
}
Thanks! Really pleased you liked it!
Great article! You're a great PHP developer aren't you? Will you give me a hand with improving this Slim 3 API? Thanks!