coldbox-modules/cborm

Dynamic `not` prefixed restrictions

Closed this issue · 2 comments

Add a method in Restrictions.cfc for isNotIn which wraps the isIn statement in an isNot:

any function isNotIn(required string property, required any propertyValue){
		// infalte to array if simple values
		if( isSimpleValue(arguments.propertyValue) ){ arguments.propertyValue = listToArray( arguments.propertyValue); }
		return isNot( variables.restrictions.in(arguments.property, arguments.propertyValue) );
}

I went a step further and did dynamic negations like we do in TestBox. You can now negate any criteria restriction by prefixing it with a not. So you can do: .notEq(), notBetween(), notIsNull(), notIsIn() and much more.

Awesome! :)