Just wrote an command line tool for my web application where a valid url is recommended. So I called an instance of CUrlValidator to check the first argument and guess what: that doesn’t work. The validate method expects an instance of CModel.
So my idea is to split up ALL validate functions into 2 methods:
[*]A part, that prepares all that CModel related stuff (if instance is right, if some flags are set, …)
[*]a static part where just the value itself is checked: return preg_match($this->pattern, $value)
So it’ll be possible to check for an valid number, email, url, ip, … even if the value is not related to a CModel.
If I’m completely wrong and there’s another way (except getting the $pattern out of the validator and run a preg_match for my own), let me know.