Category: Software Development
-
Javascript and contenteditable how to move the cursor to the end of user input
This appears to work in all browsers. Let me know if you find issues. So this is something I needed to do and all the examples I found didn’t work properly. Or they worked partially, or only in one browser. The idea seems super simple, but in reality the problem becomes complex for several reasons.…
-
Symfony how to get query string values sent by AJAX calls
When using a Symfony API endpoint for getting values such as maybe something like an auto-complete feature you will need to be able to send some text(what the user enters) to the backend. Then have the backend return a response based on that. For example with an auto complete feature, you might want to send…
-
Php Backed Enums don’t forget to call value
The one thing I don’t like about new PHP enums is, if you forget to call ->value you get exceptions “object can’t be converted to string” It is entirely too easy to forget to call ->value. This means in places where I refactor code I have to remember to call ->value. Hence the article title…
-
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…
-
How to list all stopped and running Docker containers
I often need to do this but forget exactly how to do this. I don’t know if this has changed. I could swear it has changed. You will probably find crap all over the internet telling you to use docker ps But that only lists running containers. Same story for docker container ls So how…
-
How to create 100+ Symfony 5+ Doctrine 2 or 3 Repositories
Scroll to the bottom to view a video of this Repository maker in action. I make about 100 Repositories in less than 2 minutes. You can go faster by just hitting enter really fast. LOL NOTE – repository in the sense of this article means a Doctrine Repository Object. This object is used to interact…
-
How to install Redis with Docker for local testing
In another article I suggest installing Redis with docker but do not tell how. In this article I cover how to get a Redis Image up and running with Docker locally. First you need to install Docker for your system. After you have Docker installed, next you need to download a Redis image. Here is…
-
Tips and tricks to reverse engineer your existing database with Doctrine for Symfony
So in the Symfony documentation there is a page that describes how to reverse engineer an existing database using Doctrine. Rule #1 No DB Vendor custom types The only problem is this technique will only work with databases that are generically designed. Meaning you can’t use some of the DB vendor specific types etc. This…
-
How to fix Unknown database type enum requested, Doctrine\DBAL\Platforms\MySQL80Platform may not support it.
So you got this lovely error when trying to reverse engineer a database with doctrine. This error means that your database uses ENUM and is probably running on MySQL. MySQL also contains SET which is about the same as ENUM except enum allows only 1 value from the list( or empty string or NULL) and…
-
How to reverse engineer a database for a symfony project with doctrine… aka t_
TLDR This is a parody about how I learned to Reverse engineer a Database for a Symfony App with Doctrine. Here is a short article including tips and tricks I discovered I learned while writing this. This article jokes about some of what I ran into and what I was thinking while I learned Doctrine.…