Month: October 2021

  • How to fix Symfony FosJsRoutingBundle outputs routes in browser

    How to fix Symfony FosJsRoutingBundle outputs routes in browser

    Yeah I got this problem once too. The routing bundle outputs the routes in your browser on a plain white background, giving the user no options to navigate etc. after they register or login. So how do you fix this? Read the last step of this article I wrote How to get URL Routes in […]

  • How to fix Symfony Compile Error: Cannot use Repository as Repository because the name is already in use

    So you got this error? WTF does it even mean? Well my actual error was this. Compile Error: Cannot use App\Repository\PageUrlsRepository as PageUrlsRepository because the name is already in use You can see here what I did is accidentally add a second use statement. I remove that and BOOM all back to normal.

  • How to secure individual Symfony AJAX api routes without using API Platform

    How to secure individual Symfony AJAX api routes without using API Platform

    I am in the process of updating this article entirely. Please stay tuned. Creating the Symfony route is easy. Checking if the request was sent by AJAX is again easy. But what stops a mischievous hacker from hitting that endpoint and trying to get a list of used emails or something else with a script? […]

  • Symfony 5.3+ how to use Sessions with RequestStack

    So some changes happened in Symfony 5.3. Previously you could get to a session with either Session or SessionInterface. Some didn’t like how that worked so now it is moved to RequestStack. The docs or article are not correct here. It shows you get to the session like this. $session = $this->requestStack->getSession(); But that doesn’t […]

  • Symfony 5+ how to make a form field hidden from display

    Symfony 5+ how to make a form field hidden from display

    This is easier than it sounds, but I am writing this in case I need to remember what the answer is. At first I wasn’t paying attention to all of the many different Symfony form types in this long list.  I totally didn’t see the HiddenType in the list or I didn’t notice it. I […]

  • How to change the id for a form input in Symfony 5+

    How to change the id for a form input in Symfony 5+

    If you create your forms with classes in Symfony 5+ then changing the ID of the form fields is something you are not allowed to do apparently. LOL You can add/change the class and other attributes but not the id. For some reason Symfony ONLY lets you change the id inside the template. I don’t […]

  • Symfony 5+ Twig templates don’t forget to call the parent

    Symfony 5+ Twig templates don’t forget to call the parent

    Twig templates use inheritance and allows you to create named sections like this. <!doctype html> <html lang=”en”> <head> <meta charset=”UTF-8″> <meta name=”viewport” content=”width=device-width, initial-scale=1, shrink-to-fit=no”> <link rel=’icon’ href=”{{ asset(‘images/favicon.ico’) }}” type=’image/x-icon’ > {% block head_extra %}{% endblock %} <title>{% block title %}{{ title }}{% endblock %}</title> {% block stylesheets %} {# ‘app’ must match the […]

  • Symfony 5+ how to include page specific javascript or css when using Webpack encore and SASS

    Symfony 5+ how to include page specific javascript or css when using Webpack encore and SASS

    In this article I will cover how to do this with Webpack in Symfony with CSS and SASS. This is slightly confusing. Symfony has it’s own Webpack configuration called encore. Read that documentation article if you need more info, more links at the bottom of the page. Webpack Config First lets checkout the file app\webpack.config.js […]

  • How to make AJAX requests to Symfony 5+ controllers

    How to make AJAX requests to Symfony 5+ controllers

    I couldn’t find anything in the documentation about this and there is little on the internet about it too.  There is probably a Bundle somewhere for this or some Symfony way, but I didn’t find anything. I did find this SymfonyCast about submitting a whole form. If you need to test your Controller route read […]

  • Why Amazon search sucks and how it can be fixed

    Why Amazon search sucks and how it can be fixed

    Well, someone had to say it! This is about more than just amazon search sucking. It is about the entire tech industry and the assbackwards hiring practices they are using. This started out as a simple Amazon search sucks article, until I decided to dig into their hiring process. I then discovered their hiring process […]