This piece of code current errors `var blocks by B...
# exposed
j
This piece of code current errors
var blocks by Block referrersOn Blocks.articleId
t
What kind of an error?
j
Hi Andrey, this is the error
t
I see, it's because you use
var
instead of
val
. At the moment it's impossible to set collection to refererrs field. You have to update
articleId
field of
Block
class instead.
The main problem is that when you "write" a collection you have to
clean
reference from entities which already linked to
parent
entity. And if it's not optional field than the whole code will fail. E.g. Article.A has two block Block.A and Block.B, then you're 'trying to set Block.B and Block.C to
blocks
field of Article.A. What should happen with Block.A?
j
Ah I understand, thanks 👍