1

There does not seem to be proper documentation available on how to configure and use database views with the doctrine migrations bundle.

  1. One probably is not able to map SQL statements which will end up creating/updating a database view (from the sql given somewhere) when migrations:diff and migrations:migrate are run.

  2. If an entity is mapped to a database view with the @table(name="view_name") markup, it ends up causing an error / new table being attempted, instead of understanding that its a database view being used.

Is there a solution? Am I missing something?

Jack
  • 99
  • 5
  • Help this? https://stackoverflow.com/questions/8377671/how-to-set-up-entity-doctrine-for-database-view-in-symfony-2 – Hans FooBar May 23 '20 at 23:49

1 Answers1

0

I'm not sure that doctrine can get out of the box views. For all I know, you'll have to cheat.

Or:

I think you have to write the migration script yourself.You can generate an empty one and then write the create-statements into it.

In the repository you integrate native sql. The result you map to your entity or DTO. https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/native-sql.html

Hans FooBar
  • 149
  • 11