Igor's Blog
Programming, DIY, Games, Hacks, and Tech

I've created a new Silex controller, all the setup for it seemed fine, but for some reason it wasn't working. Every time I accessed a route for that controller, I got an error stating that the $request argument wasn't provided, like so...
silex_reqerr.png


Here's a more detailed exception stack trace...
 Exception
Whoops, looks like something went wrong.
(1/1) RuntimeException
Controller "PCS\PcsDownloadController::initDownload()" requires that you provide a value for the "$request" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.
in ArgumentResolver.php (line 78)
at ArgumentResolver->getArguments(object(Request), array(object(PcsDownloadController), 'initDownload'))
in HttpKernel.php (line 145)
at HttpKernel->handleRaw(object(Request), 1)
in HttpKernel.php (line 68)
at HttpKernel->handle(object(Request), 1, true)
in Application.php (line 496)
at Application->handle(object(Request))
in Application.php (line 477)
at Application->run()
in store.php (line 21)
at require('/Volumes/Data HD/Personal/_git/travelblog.ws/marketting/pcs/store.php')
in setup.php (line 147)


After some debugging it turned out that I was missing the following line from my controller class:
 PHP
use Symfony\Component\HttpFoundation\Request;




It was as simple as that!

-i

Please leave your comments or feedback below!
comments powered by Disqus
Other posts you may like...

Recent Blog Posts

How to enable the full stack trace in Maven's Surefire plugin for JUnit testing

Twelve elements of the Burst Mining Pool interface explained

TPG FTTB settings for the Billion BiPAC 8700AXL 1600 modem router

Protecting old Atari Lynx game boxes with snug fit plastic sleeves

How to fix SoapUI javax.net.ssl.SSLHandshakeException calling WebLogic 12.2 web services on Java 8

Woolworths (WOW) shares disappeared from Computer Share Investor Centre

Connecting the Dell UltraSharp U3415W monitor to a MacBookPro via USB-C

How to add/change PHP versions appearing in MAMP preferences

Fix the ORA-00904: ORA_ROWSCN: invalid identifier error in SQLDeveloper with a few easy steps

G Suite Gmail is broken on Safari due to new Google Content Security Policy settings

Recent Galleries

Protecting old Atari Lynx game boxes with snug fit plastic sleeves

Monument Valley 2 is released and does not disappoint

Space Food - Chocolate Ice Cream with Chocolate Chips

Legeod Star Wars AT-DP kit

DIY spare parts computer build with a RAIDMAX Anura case

Fake 'Lepin' brand Lego packaging

Hardwood garden bench with clear resin void filler

Fixing a 3D printer extruder that stopped heating up

Easily increase disk space in a Lenovo Ideapad 100S 14" laptop with an M.2 SSD

Making a multi-piece 3D printed solder spool holder stand

My Other Web Sites

Igor and Elise's Travels
Riverside Expressway Cam
300 George St Blogumentary

My Online Tools

UUID to OID Converter
Guru JSON-RPC Tester
Extrudifier Object Designer
Travel ┬ÁBlog

Blogs and Friends

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity
Don't forget to
my Facebook page for more great articles!
Don't show this again