0

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.

4
  • 2
    stackoverflow.com/questions/67829014/… Commented 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. Commented 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. Commented Jun 19, 2021 at 0:39
  • "it forces me to use DATABASE_URL" - what exactly does that mean? Commented Nov 5 at 15:17

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

This didn't work for me. It just resulted in other errors.
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?
-1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.