Symfony 4 get all POST data

“How do get all the submitted form data?” When I was learning Symfony this was something I couldn’t find a noob-level answer to. All the tutorials want to introduce you to the Symfony form module right away. But if you’re like me and want to understand how things fit together before using some overly complicated object to build a simple form then the below information may be useful.

How to get all values from a form submit in Symfony 4.

/**
* @Route("/", name="form_submit",methods={"POST"})
*/
public function my_form_action(Request $request)
$everything = $request->request->all()
;

Advertisements

Evil Kinevil Jr 2018 Edit

Behold the awesomeness of my 7th grade claymation!

Took me 3-4 months to make this video during free period in 7th grade in 1992.
This video originally had Kenny Loggins Highway to the Danger Zone, but I swapped it out for DFR to avoid any copyright issues.

 

 

 

 

Blockbuster memories

Ah Blockbuster… blech!  Now that Blockbuster is gone it’s time to reminisce about those bygone days. Things I remember about Blockbuster:

It must’ve been the summer after my freshman year of college that I worked at Blockbuster. I didn’t want to go back to my computer warehouse job even though it was pretty easy and paid well. I was afraid I’d wind up working in a warehouse  forever

Everyone should take a retail job at some point. It will hammer home how important politeness and manners are. I knew that dealing with the public would also be useful experience as I’m normally pretty introverted.

Working at Blockbuster really demanded that I talk to strangers. We had to greet everyone that came through the door. We had to sell the “Blockbuster Rewards” plan to everyone that came to checkout. If we didn’t give the long-winded speech about why the rewards program would be good for them then we got in trouble. Often people signed up just to get the immediate free movie rentals. I think it was a $30 a month subscription which was not worth it, but many people bought it anyway. Along with selling them a subscription service, we also were supposed to get their CC number on file so that we could auto-bill them if they were late which seemed scummy. By the time all the selling and collecting of info was done it seemed to take 20 minutes to checkout each customer. There were long lines on Friday & Saturday nights, customers were visibly frustrated, but we had to keep selling or get in trouble!

Each rental tape had a barcode on the back of it that we scanned in and out to keep track of inventory. There was always the possibility we missed scanning a tape back in, but there was also a fear that a customer who had a late rental would sneak it back into the store and place it on the shelf then tell us they returned it on time to avoid paying the late fee. Each day when the store opened I received a printout with a list of barcodes and movie names and my job was to go check to make sure that those videos weren’t out on the shelves.

The store closed at midnight. Sometimes after we closed we’d do a full inventory count on every single movie. It would last for hours until the early morning light.

There were TVs installed throughout the store that played a short promotional tape on a loop. Each tape seemed to contain a few movie trailers, one pop music video, and a commercial or two. Every few weeks the tape was swapped out with a new promotional tape. For the first few minutes it was exciting to see what movie trailers were on it, and to hear the new song! Quickly it became obnoxious to hear the same Britney Spears song over and over again, and then your brain would tune it all out and the tape faded into the background, until suddenly your brain picked up on it again and it made you feel crazy.

I think what I learned while working at Blockbuster is relationships matter. Some Corporations will treat their customers as badly as they can get away with. Abused customers and will fight back anyway they can. If people don’t like you, they will leave as quickly as they can when a better option comes along. Facebook’s contempt for their own customers reminds me a lot of Blockbuster and I predict things will not end well for them.

Good riddance to any company that treats their customers badly.

How I tumbled down a river – The 2014 Quinebaug River Race

I didn’t know what I was getting into…

 

blue_canoe_damage

My brother-in-law said “hey you want to enter a canoe race?”  An excuse to paddle down river in early spring sounded like a great idea. He recruited my father-in-law and I recruited my brother and the four of us entered the All-American Quinebaug River Race. They were #30 in a 14 foot green Old Town canoe, and we were #31 in a battered blue 12 foot Lincoln canoe.

I was unaware that this canoe race had class II rapids.
Continue reading “How I tumbled down a river – The 2014 Quinebaug River Race”

Best practices – a poem

I.T. took away my remote server access today
Now I can only code local-ly
Though I don’t blame them, I’d just like to say
If my code hygiene needs washing
These bugs that I’m squashing
Weren’t found in Q.A.

‘Best practice’ was my first and my middle name
I agiled my scrums, I sprinted my days
Test-driven delivered a build to throw away
But the users don’t understand it
And they simply demanded it
Be fixed right away

Pear's mail_mine not working with Outlook

In a WordPress plugin I am developing, I am using Pear’s mail_mime to generate an HTML email and send it with an attachment. This worked fine for me during testing with my gmail account. However once I started using the plugin to send emails to others, Outlook users were getting a garbled mess. Outlook could not properly understand the generated multipart/mixed message and was showing the raw text. It took a bit of digging to discover the solution, but the root of the issue goes back to an age-old C.S. problem.

Windows uses ‘rn’ to define a line break, while Unix-like systems use ‘n’ to define a line break. Gmail doesn’t care which kind of line break you use, but Outlook requires line breaks to be in the ‘rn’ format.

Mail_mime allows you to pass the default for line breaks as a constructor argument. However, this didn’t work correctly for me. The Mail_mime code uses the End-Of-Line constant (PHP_EOL) and passing the EOL value in was not enough to change the value in all places.

What I had to do to finally get Outlook emails to display correctly was to first define the PHP_EOL constant and then pass it in as well.

// define the PHP_EOL constant
if (!defined('PHP_EOL')) define ('PHP_EOL',"rn");
// pass in the value on create
$mime = new Mail_mime(PHP_EOL);

I had to define the constant AND pass in the value to catch all the places the linebreak characters were used. This seems like a bug in Mail_mime.

I used the comments on this bug report to solve this issue. Unfortunately since this work-around was discovered, the maintainers don’t seem willing to fix this issue.