Summary: This is a question about how to best validate one-to-many relationships.

 

Does anyone have sample code to validate over an Iterator (maybe to look for duplicates) that they’d be willing to share? I’ve had no problem validating each member of the Iterator, but I’m a little confused about how to best compare different records in the Iterator to look for conflicts and deficiencies.

 

For example, let’s say I have a teamRecord and that has many playerRecords in the getPlayerIterator(). I put most rules to validate specific player fields into the playerValidator and refer to errors in the playerDictionary. But, if I want to validate for errors among the group, (no shortstop in the lineup, too many players on the roster, not enough pitchers, duplicate players) I assume that those validation rules would go into the teamValidator and would have to loop over the getPlayerIterator() since the playerValidators would not be aware of the other playerRecords in the Iterator. Now, if I found an error, should I refer to the teamDictionary since I’m validating from the teamValidator perspective, or do I refer to the playerDictionary since the database fields in question are already mentioned there?

 

Am I on the right track here? Don’t get too hung up on this simplified example. I am just using it to illustrate my confusion on how best to validate one-to-many relationships.

 

Thank you in advance,

Dan

 


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to