8.4.2: how to save block entity in doctrine

Permalink
I need to keep track of blocks used in my package and save them in a table created by my package's doctrine.

The problem is if the block is edited and saved it gets a new id. How can I keep track of the block and have it updated automatically if it changes the id? Blocks don't seem to have entities like users. With users I can so this:
/**
     * @ORM\ManyToOne("Concrete\Core\Entity\User\User")
     * @ORM\JoinColumn(name="site_user",referencedColumnName="uID",onDelete="SET NULL")
     */

What can I do about the block?

Thank you.

linuxoid
 
linuxoid replied on at Permalink Reply
linuxoid
There's duplicate() method for a block. But if my package stores bIDs, how will it know which bID has changed? On the other hand how will the duplicate() know which table entries store old bIDs?

And what if the user decides to go back to previous versions of the page with old versions of the block? What then?

Is there any way around this? Are there any examples how to keep track of the block IDs?

If I make a table with Doctrine during the package installation, not in the block, and name it, say, btMyBlock, will the block controller update it properly on saving the block with new bID?

Or can I disable creating of the new bID on saving my block?