Skip to content

Loading…

DBAL-550: Complete/non-overridable event dispatching in DDL methods of AbstractPlatform #1759

Open
doctrinebot opened this Issue · 4 comments

2 participants

@doctrinebot

Jira issue originally created by user stefk:

The default implementation provided by the AbstractPlatform class dispatches several events related to schema modifications (create table, change column and so on) and offers the ability to prevent the default behaviour by setting a flag on the dispatched event. However, it appears that some DDL operations aren't covered by this mechanism (foreign keys creation, for example, doesn't seem to be observable). Furthermore, the concrete platforms can override any of these methods, potentially leading to inconsistancies in components that expect those events to be dispatched.

I'm working on a large modular application build on top of Symfony, in which each bundle must have its own migration classes (i.e. migrations on a per bundle basis, not at the application level), possibly with references to other parts of the schema. I used to write those classes manually using the dbal api, but this is tiedous and error-prone, and I'd like to take advantage of the mapping-based schema generation. I found that using the event system and "filtering" ddl operations to keep only the operations related to a given bundle is a clean and easy way to achieve this goal, but the issues I mentionned prevent me to complete the implementation.

I'd be glad to hear your opinion on that topic and, providing you're interested in it, contribute in a way or another to improve the existing code.

@doctrinebot

Comment created by @beberlei:

This is not a blocker

@doctrinebot

Comment created by @beberlei:

The DBAL event system is not in its best shape and definately could use some improvement. Your easiest way however would be to hook the process of generating the whole schema, and then dropping tables from those two to only contain the ones you are interested in.

@doctrinebot

Comment created by stefk:

That's indeed the simplest solution. Thanks a lot for your answer.

@doctrinebot

Comment created by @deeky666:

[~beberlei] Is there anything to do here? Should the missing events be added or is that not necessary?

@beberlei beberlei was assigned by doctrinebot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.