06 Dec 2009, 07:51
Generic-user-small

Marco Ivani (3 posts)

Hi Marcus,

First of all, I’d like to thank you for have written this book, it’s a precious resource indeed. That said, my problem is when we have to migrate model V1 to model V2, replacing the types Meat and Fish with the type Entrée. Why it is necessary to also add the filter predicate type != ‘Fish’ && type != ‘Meat’ to the RecipeToRecipe entity mapping? Why is not sufficient the filter predicate added to the Fish And Meat em?

Thanks for your patience.

Best regards,
MI

05 Dec 2009, 17:28
Generic-user-small

Marco Ivani (3 posts)

I’ve got it. The first entity mapping (em) is like a pass for all the recipes that have a type != Fish && Meat (their type isn’t changed: $source.type). The second em instead is responsible for updating the type property of the remaining recipes (those with a type == Fish || Meat). Right?

In fact, on second thoughts, the first predicate filter is the exact logical reverse of the second one. So, if we have to do with these sort of things, we have to build up two different entity mappings. Is there a more elegant solution by chance?

Thanks,
MI

10 Dec 2009, 08:11
Avatar_pragsmall

Marcus S. Zarra (239 posts)

That solution itself is pretty simple but for that precise situation it is probably a bit of a cannon. Another solution would be to override the attribute duplication step of the migration process and put in some custom logic. However that is more code it would be less migration passes. Kind of a wash.

10 Dec 2009, 11:46
Generic-user-small

Marco Ivani (3 posts)

Ok, thanks for your answer!

Best regards,
MI

  You must be logged in to comment