FireWire Posted August 12 Share Posted August 12 Found something that may be of help to others. I have a RPB block that has a basic repeater field and uses a block migration. Rather than writing the migrations by hand, I've been copying RockMigrations code from fields to help make short work of writing migrations in block files. Example: Running migrations ended up causing a system template to be created every time modules were refreshed: I found the culprit in the block migration: <?php $rm->migrate([ 'fields' => [ 'listItems' => [ 'label' => 'List Items', 'type' => 'FieldtypeRepeater', 'fields' => [ 0 => 'text', ], 'template_id' => 0, // Potentially causes duplicate template creation 'parent_id' => 0, // Potentially causes duplicate template creation // ... ], ], // ... ]); Removing those two migration properties for that field resolved the issue. I'm not sure if this has any effect on other block migration field types since I haven't created too many in this project yet, but something to keep in mind when using the migration code output from an edit field page. @bernhard Is this something that an update in blocks where migration arrays could be "sanitized" to remove any properties that would conflict with how RPB needs fields to be created? Thanks for your work as always @bernhard! Link to comment Share on other sites More sharing options...
bernhard Posted August 12 Share Posted August 12 2 minutes ago, FireWire said: @bernhard Is this something that an update in blocks where migration arrays could be "sanitized" to remove any properties that would conflict with how RPB needs fields to be created? That would be nice to have for sure. If anybody wants to add it I'm happy to merge ? 1 Link to comment Share on other sites More sharing options...
FireWire Posted August 12 Author Share Posted August 12 1 minute ago, bernhard said: I'm happy to merge Can I get access to the repo? Can't guarantee I can tackle this right now, but when I can I'd be happy to work on it! 1 Link to comment Share on other sites More sharing options...
bernhard Posted August 12 Share Posted August 12 2 minutes ago, FireWire said: Can I get access to the repo? I think what you suggest would be part of RockMigrations, which is public, no? Link to comment Share on other sites More sharing options...
FireWire Posted August 12 Author Share Posted August 12 @bernhard I've only experienced this when creating migrations inside block PHP files for RPB. I haven't looked but would there be something inside RockPageBuilder that filters block migrations before they're handled by RockMigrations? Link to comment Share on other sites More sharing options...
bernhard Posted August 12 Share Posted August 12 I don't think that it is related to RPB, but not sure. I can't give you access to RPB on github, but that's not necessary anyhow. If you find something just send me the files and I'll merge them manually. I have to admit though that it's not a priority for me to keep these migrations code sections 100% accurate. It's there to get help when writing migrations but it's definitely nothing that should be copied 1:1 There are many inconsistencies in PW api / migrations API like for example RM using field and template names all over and PW using ids, which is not readable/maintainable in migrations. So I'm not sure how much work the problem you have found justifies ? Link to comment Share on other sites More sharing options...
FireWire Posted August 12 Author Share Posted August 12 @bernhard I took a quick look and understand what you mean. Thanks! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now