ColdBox-3.5 Validation

I’m having some trouble using a specific feature of the validation that is in CB 3.5.
Here are my constraints:
this.constraints = {
‘label’ = {
required = true,
size=‘2…100’,
requiredMessage = ‘A Product Name is required.’,
sizeMessage = ‘It must be between 2 and 100 characters.’
},
‘price’ = {
required = true,
type = ‘numeric’,
requiredMessage = ‘A Product Price is required.’,
typeMessage = ‘It must be numeric.’
},
‘producttype’ = {
method = ‘ProductTypeConstraint’,
methodMessage = ‘A Product must have a product type.’
},
‘currencycode’ = {
method = ‘CurrencyCodeConstraint’,
methodMessage = ‘A Product must have a currency code.’
}
};

First two are straight forward. Second 2 are orm relationship properties, and what they do is very simple:

public boolean function ProductTypeConstraint(Any Value, Any Target) {
return ( arguments.Target.hasProductType() ? true : false );
}
public boolean function CurrencyCodeConstraint(Any Value, Any Target) {
return ( arguments.Target.hasCurrencyCode() ? true : false );
}

The problem is, CB will error with

Hmm an update, found out the reason: If the relationship property, currencycode in this case, is null - MethodValidator will error. I assume this is because the validator is expecting some kind of value but instead receives a null?

Can anyone help me get insight on this and maybe a possible solution / workaround / etc?

What about the properties themselves.

Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/
Google+: http://plus.google.com/113032480415921517411

They’re fairly simple.

property name=“producttype” fieldtype=“many-to-one” cfc=“model.entity.merchantry.product.producttype” fkcolumn=“producttype_id” lazy=“false” remotingfetch=“false”;
property name=“currencycode” fieldtype=“many-to-one” cfc=“model.entity.merchantry.currencycode” fkcolumn=“currencycode_id” lazy=“false” remotingfetch=“false”;

So you are trying to validate a relationship, I am not sure that works with Validation.

Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/
Google+: http://plus.google.com/113032480415921517411