So, I wrote an example XML file describing what I wanted. I've copied it below:
Code: Select all
<sample>
<field name="title">
<filter type="String" emsg="Must specify a title." />
<filter type="Callback" emsg="Title must be unique.">
<arg name="callback" value="Movie::isUnique" />
</filter>
</field>
<field name="rating">
<filter type="Int" emsg="Must specify a rating between 1 and 5.">
<arg name="min" value="1" />
<arg name="max" value="5" />
</filter>
<transform type="Int" />
</field>
</sample>
I'd love some advice with the code I've written to turn this XML file into something that does work. It's all rough (and poorly named) but I think it's worth looking at. What's most important in my mind is that it be easy for myself or others to write new filters/transforms in the future.
I'd also love some suggestions on how to modify the current code to allow for aggregate operations. For instance, checking that two fields in the collection matched (say password and confirmed password).
The code is attached. Thanks!