[eluser]ntheorist[/eluser]
changing the 'id' parameter may turn into a headache and could cause unexpected results, but if i were forced to do it in a pinch, i would (on a working copy at first) run the following search & replace commands:
"['id']" to "['itemid']" (to convert any array accessor
"->id" to "->itemid" (coverting object accessors)
"`id`" to "`itemid`" (converting sql - those are backticks)
can't say that will get EVERY instance, but that's what you're going for. Otherwise, no theres no variable setting such as $idfield (although there could be)
as for alpha_dash, you can create any method on your model and use it in the rules array. It just has to start with an underscore '_'
so to create a rule that checks alpha_dash PLUS the '@' symbol you could add this to your models,or to datamapper (or prolly better, an extension of it) if you want it available to all models.
Code:
function _alpha_dash_at($str)
{
return ( ! preg_match("/^([-a-z0-9_-@])+$/i", $str)) ? FALSE : TRUE;
}
then in your validation array on the field you want to use it on include that in the rules array – ie rules' => array('alpha_dash_at')
hope that helps.
n