Why does my block get a new bID sometimes?

Permalink
Hi,
I am on 5.7.5.9. I have a custom block. I use the blocks bID as a foreign key into a detail table of additional attributes. SOMETIMES when I edit the block, it saves with a new bID. Most times it does not. I am still editing and working on the block.

Can someone tell me what causes the block to save with a new bID after editing? Is it some kind of versioning? It is driving me nuts! My testor enters like 60 values into the detail table, then saves the actual block and poof - all the details are gone becuase the new bID no longer links the detail records.

Thanks in advance.
Sean

 
ob7dev replied on at Permalink Best Answer Reply
ob7dev
Yes it has to do with versioning. Blocks will get a new block ID anytime a new version is made, which can be as often as a single edit, unlike page ID's which stay the same.

If something is breaking because the block get's a new ID, then something's off with the way you're approaching whatever need your code is trying to solve. I made the same mistake before when trying to load data from certain blocks into other blocks based on block ID's, and when they change, things broke.

It all depends what you're trying to do, but your code should be able to achieve the same result without relying on hard coded block ID's.