I've just started using Symfony. Firstly, I have no database in my small project. However, it forces me to use DATABASE_URL. So, I have to create a database. When I do this, the project works. Do I have to do this every time? I don't want use a database for small projects. Thanks for your answers.
-
2stackoverflow.com/questions/67829014/…Cerad– Cerad2021-06-18 23:21:25 +00:00Commented Jun 18, 2021 at 23:21
-
You'll need to be more specific about what you're trying to do. Symfony is a framework made of dozens of libraries, you've given no indication what ones you're trying to use.miken32– miken322021-06-18 23:52:10 +00:00Commented Jun 18, 2021 at 23:52
-
@miken32 There is always a tradeoff between too little and too much info in a question. However, this sort of question gets asked every couple of days. The question is always a bit different but the problem and the solution is the same.Cerad– Cerad2021-06-19 00:39:05 +00:00Commented Jun 19, 2021 at 0:39
-
"it forces me to use DATABASE_URL" - what exactly does that mean?Nico Haase– Nico Haase2025-11-05 15:17:40 +00:00Commented Nov 5 at 15:17
Add a comment
|
2 Answers
Look like you use doctrine/doctrine-bundle inside your project. Just delete it composer remove doctrine/doctrine-bundle if you don't want to use database for your small project, then you don't need to set DATABASE_URL
2 Comments
authentictech
This didn't work for me. It just resulted in other errors.
authentictech
I didn't note it down but the initial line in the stacktrace mentioned ArrayLoader.php. I just set up a DB and got the "first page" tutorial working. However, I have just tried the composer command you suggested again and it worked (after also removing a mentioned dependency). The lines relating to the database were automatically removed from the .env file (which surprised me - I wanted to make a note of the connection URL). The profile debugger toolbar still works which I did not expect as I heard it depended on a DB. I suppose it is not a dependency but just uses it if a DB is present?
As per this the 'Databases and Doctrine ORM page (https://symfony.com/doc/current/doctrine.html)
I edited the .env file and used dummy values for the database url and password this satisfied Symfony.