jbroadway/elefant — Issue #71: Add extended attribute to Model validation so it's aware of extended properties
Author: jbroadway
Created: 2012-01-27 20:39:00+00:00
State: open
Labels: feature

In the `$verify` property it would be specified as:

```php
class MyTable extends ExtendedModel {
public $verify = array (
// ordinary fields, then...
'photo' => array (
'regex' => '/.*\.(jpe?g|png|gif)$/',
'extended' => 1 /* this is new! */
)
);
}
```

And in INI you would just add:

```
[photo]
extended = 1
regex = "/.*\.(jpe?g|png|gif)$/"
```

Then ExtendedModel could use that in its `__get()` and `__set()` to determine whether to update `$this->data` or `$this->{$this->_extended_field}`, and also provide validation against those values too (by overriding `put()` method?).

Note: May also need to edit `put()` in Model to know to skip verifying fields marked as extended.

For more info, see:

* http://www.elefantcms.com/forum/discussion/comment/86#Comment_86
* http://www.elefantcms.com/wiki/Validation-in-Models