From the code / configuration perspective, it all looks okay to me.
The only reasons it would be mapping PartnerShips is if the were no nodes to map it to, or that internally DittoPickerConverter couldn't work with the value from MNTP (and returned a null).
var parentNode = Model.Parent;
var partnershipDefaultSet = parentNode.GetPropertyValue<IEnumerable<IPublishedContent>>(DocTypes.Stations.Properties.PartnershipDefaultSet._Name);
var y = parentNode.GetPropertyValue("partnershipDefaultSet");
To get this working I can remove the prop from the model and then just handle it with IpublishedContent but TBH I got no idea why ditto is getting crazy with it and I'm curious now. If the code looks OK, what else could that be ?
OK, we can see that it's definitely creating a list of PromoBox objects, but each one of them is null. Which I suspect that DittoPickerConverter isn't playing nicely with...
Try removing the TypeConverter attribute from the PromoBox class and adding it to the PartnerShips property.
[TypeConverter(typeof(DittoPickerConverter))]
[UmbracoProperty("partnershipDefaultSet")]
public IEnumerable<PromoBox> PartnerShips { get; set; }
Ditto is not mapping OK
Hi there,
so I got these models:
For some reason that I can't understand TravelTips is mapping OK but PartnerShips is not.
Ideas ?
Thanks,
Ale
Hi Ale,
Is the Umbraco property alias that it's being mapped with definitely called "partnershipDefaultSet"?
I recall Ismail having an issue where the nodes picked by an MNTP had become unpublished?
https://our.umbraco.org/forum/developers/api-questions/75382-getpropertyvalue-returns-null#comment-241260
Cheers,
- Lee
Hi Lee,
That's not the case and 100% the prop alias is "partnershipDefaultSet"
Any other suggestion ?
Cheers,
Ale
...and the selected nodes of the MNTP are published?
(sorry if that sounds abrupt, just that I spend a fair amount of time with Ismail on this previously)
The same mapping
public IEnumerable<PromoBox> PartnerShips
is working with other models using the same MTNP nodes.(No worries, :) )
From the code / configuration perspective, it all looks okay to me.
The only reasons it would be mapping
PartnerShips
is if the were no nodes to map it to, or that internallyDittoPickerConverter
couldn't work with the value from MNTP (and returned a null).If you were to call...
...what would you get back? Is it a CSV string of node IDs, or a list of
IPublishedContent
objects, or something else?Thanks,
- Lee
To get this working I can remove the prop from the model and then just handle it with IpublishedContent but TBH I got no idea why ditto is getting crazy with it and I'm curious now. If the code looks OK, what else could that be ?
Cheers,
Ale
Thanks for the info. Hmmm, Ditto should be totally fine with taking a list of
IPublishedContent
, not sure why it wouldn't be mapping.Just for clarification, when you say that
PartnerShips
isn't mapping... what is the value ofparentNode.PartnerShips
here?... is it actually null or an empty list of
PromoBox
?I'm trying to figure out from the Ditto code where it might not be working...
https://github.com/leekelleher/umbraco-ditto/blob/0.8.4/src/Our.Umbraco.Ditto/ComponentModel/TypeConverters/DittoPickerConverter.cs#L86
...
One last question, has this worked before? Just curious if it's a new property or something that has recently broken.
Thanks,
- Lee
The same prop is mapping OK with other models, check the values:
OK, we can see that it's definitely creating a list of
PromoBox
objects, but each one of them is null. Which I suspect thatDittoPickerConverter
isn't playing nicely with...Try removing the TypeConverter attribute from the
PromoBox
class and adding it to thePartnerShips
property.See if that helps?
Cheers,
- Lee
is working on a reply...