Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add strict schema for models

  • Loading branch information...
commit db4b4d1648d7f5c8e997aa5c9084b37487de8cfe 1 parent 77f0680
Ryan Schumacher authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/BaseMongoRecord.php
8 lib/BaseMongoRecord.php
View
@@ -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;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.