Content Type Manager: update_if_exists option#123
Content Type Manager: update_if_exists option#123blankse wants to merge 1 commit intokaliop-uk:masterfrom
Conversation
7b8d18c to
4a96f57
Compare
4a96f57 to
a27a854
Compare
|
Hello. I am not sure that I get exactly the need / what the bundle is supposed to do. As far as I can tell from your patch, all it does is to allow a graceful failure in case you want to create a ContentType but it already exists. On the other hand we could try to go instead for a so-called 'upsert' operation, ie. if the CT does not exist create it and, if it exists, make it comply with the yml. The problem with this second option is that it is very hard to start from a single yml definition and make it work for both the create and the update case. I have already tried to make it work (for Content, not ContentType, admittedly) in another project, and I had to come up in the end with an hybrid piece of yml that was not very beautiful to look at. As a side note, I try to make this extension be as 'generic' and 'uniform' as possible, meaning that any new yaml flag or operation should be, if possible at all, supported by all executors, not just one. What do you say ? |
|
In fact I think that it is already possible to achieve what you need, albeit in a more convoluted way: You could then add a 2nd migration, with the opposite guard condition, that applies an update |
|
Until now we managed our content types with the ezxmlinstaller extension. With my option or with a upsert mode I can put all in one migration. I would create a upsert function in the ContentTypeManager class and check if exist and call create or update. I think this function would make sense for other executers. What do you say? |
|
Here my thought in a own PR: #127 |
|
A couple of points worth discussing before we try to implement it:
|
|
Close in favor of #127 |
Adds a update_if_exists option to the create mode.
It is helpful if you are not sure if the content type already exists. E. g. for the first migration.
It could be the install of the bundle or already a update.