Browse files

add strict schema for models

  • Loading branch information...
1 parent 77f0680 commit db4b4d1648d7f5c8e997aa5c9084b37487de8cfe @jrschumacher committed Apr 25, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/BaseMongoRecord.php
View
8 lib/BaseMongoRecord.php
@@ -30,7 +30,9 @@
/**
* @var array
*/
- protected $__meta = array();
+ protected $__meta = array(
+ 'strict_schema' => FALSE
+ );
/**
* @uses stores the attributes for the record
@@ -469,6 +471,10 @@ protected function setter($attribute, $value = NULL) {
$this->{$method}($value);
}
else {
+ if($this->__meta['strict_schema'] === TRUE && !isset($this->attributes[$attribute])) {
+ return FALSE;
+ }
+
$this->attributes[$attribute] = $value;
}
}

0 comments on commit db4b4d1

Please sign in to comment.