Block ID duplication
Permalink
There is a behaviour I wasn't aware of for a while. It might be useful to know about it when you build your own block..
As mentioned in the documentation every table that is specified in the controller must have a column "bID" which is used to link the block tables to the actual page/block.
When you edit a block, concrete5 creates a new entry in that table. It basically duplicates your data. This is useful because this way, it is possible to "go back in time". You can remove a page version including the block versions.
In my case this behaviour causes a few troubles since I wanted to integrate another system. Means: Two system are updating a few tables and this can be complicated if one system updates the data without informing the other one. I could have added some interfaces between those systems but that's an extra effort.
I then realized that it's quite easy to get the currently published block id. BlockRelations and all the version tables are helpful for that..
I think it would be great if someone with beter english skills good add a note about the behaviour in the documentation (if it's not already there - couldn't find anything)
As mentioned in the documentation every table that is specified in the controller must have a column "bID" which is used to link the block tables to the actual page/block.
When you edit a block, concrete5 creates a new entry in that table. It basically duplicates your data. This is useful because this way, it is possible to "go back in time". You can remove a page version including the block versions.
In my case this behaviour causes a few troubles since I wanted to integrate another system. Means: Two system are updating a few tables and this can be complicated if one system updates the data without informing the other one. I could have added some interfaces between those systems but that's an extra effort.
I then realized that it's quite easy to get the currently published block id. BlockRelations and all the version tables are helpful for that..
I think it would be great if someone with beter english skills good add a note about the behaviour in the documentation (if it's not already there - couldn't find anything)
This way, page versions lets you go back to a previous version of the page as though the block was never changed.
This can cause problems when you're assuming all blocks are going to be unique and approved, however.. For example, when you create a product block, if you edit the block to lower the price, the old bID of your product block is still in the system...and if you have custom scripts that process those blocks they need to know that those old bIDs are no longer valid.
Just another little bit of useful info.