Closed crevillo closed 4 years ago
The first idea that comes to my mind would be to have a reference:append
migration step. so you could create a reference as empty array, and add one value to it at every step, the use it in the step where, outside of the loop, you update the content with the relation attribute.
Otoh I think that by using a content/load step, where you manage to load only the 6 contents you just created (by filtering on content type and parent location), you can already create the arary-valued ref that you need... (one nice extension to the current matching mechanism would be to allow to match using LIKE/REGEXP/LT/GT/NE in most places where we match using equality constraints)
i was trying the content load option too, but i didn't manage to build the reference correctly. any example of that?
-
type: content
mode: load
match:
contenttype_identifier: editor_user
references_type: array
references:
-
identifier: editor_user_ids
attribute: content_id
Oh! Missed the references_type part. Brilliant. Thanks!
P.s. do you know anything like 'sequence'? Example, i have a selection field with four options. What i would like with loop is assign 0,1,2,3,0,1 to that field. Is it possible?
You can use loop
to iterate over an array. Not sure I get exactly your new case though ;-)
I'll explain it properly tomorrow. But what you suggest seems a good start...
Any update?
Ping @crevillo : you did not come back with the promised explanation. Is this still valid/relevant, or shall I close it ?
Close it. I cant remember what was this for :)
I know the title of this issue is not very clear, so let's try to explain it with a use case
so, i was trying something like
but i looks is not possibe to use loop for the remote_id. executing this migration i have this error
which makes me thing that loop:iteration is not parsed when setting the remote_id. am i right?
so, it's possible to do this in other way? or could be a good feature to add?
(obviously i could get rid of loop and just repeat the content create thing 6 times...)
Cheers