Disable bID changing for a block

Permalink
Hi there. I am implementing a block which uses multi-tables.

It is a quiz, so questions an answers are part of a separated table.

The problem is I keep loosing the associations because bID of the main quiz table changes every time I update it.

How can I keep it fixed?

Thank you very much.

arael78
 
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
Don't try and freeze the bID. Its needed for version management.

Either:
Keep track of the changing bID and update your secondary tables as it changed
or
Generate a unique ID when the block is first added, then use it to cross reference the secondary tables.

There are plenty of examples of both approaches in the core and in free blocks. Slideshow/galley blocks often need to solve this type of requirement.
arael78 replied on at Permalink Reply
arael78
Thank you. That was very fast. I will check what you have suggested.
Gondwana replied on at Permalink Reply
Gondwana
Form and survey blocks do this too.
arael78 replied on at Permalink Reply
arael78
Thank you. Will check these two blocks.