Symfony - same code, different server, field or association

I have two servers (local and one production). They have the same settings. The only thing I update when I want my new code to go into production is the src folder. So this folder is exactly the same when I press release.

On my local server, a new column in my entity / table works and can be created, updated, etc. But in my work environment, this new column is not seen or even chosen by the doctrine.

The new column is in my database (both production and local), is in my entity.php file in my entity.orm.yml file.

I made the app/console cache:clear option. Both dev and prod and on both servers.

What am I doing wrong?

+6
source share
1 answer

Finally found a solution.

Since I did not use the metadata cache on the local server, but I did it on my production server, it saved my mapping information. That is why the doctrine did not know that I had new columns. The solution was to clear the metadata cache using:

php bin/console doctrine:cache:clear-metadata

After that, I ran php bin/console doctrine:schema:update --dump-sql and I got new columns.

+4
source

Source: https://habr.com/ru/post/989130/


All Articles