Example app made for a Medium article.
The scope of the article is only Dependency Injection & SOLID principles. That's why you won't find :
- Authentication system
- Fixtures
- Unit/Functional tests
- Advanced error handling
In your .env.local
file, put the following vars :
DATABASE_URL=mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7
GOOGLE_MAPS_API_KEY=xxxxxxxxxxxxxx
A countries.csv
file is available in the data
directory. Don't hesitate to implement your own fixtures method in order to automate countries integration into your database.
I didn't do it here because it's not the scope of the article, but I figured it would be cool to have the file and the possibility to do it yourself.
The Event Subscriber is implemented into src\EventSubscriber\DestinationCoordinatesSubscriber.php
.
It will trigger on prePersist
& preUpdate
.