/** * Adds soft attributes support to magic __set method * @see EMongoEmbeddedDocument::__set() * @since v1.3.4 */ public function __set($name, $value) { if (array_key_exists($name, $this->softAttributes)) { $this->softAttributes[$name] = $value; } else { parent::__set($name, $value); } }
/** * Adds soft attributes support to magic __set method * @see EMongoEmbeddedDocument::__set() * @since v1.3.4 */ public function __set($name, $value) { if (array_key_exists($name, $this->softAttributes)) { // Use of array_key_exists is mandatory !!! $this->softAttributes[$name] = $value; } else { parent::__set($name, $value); } }
/** * If user explicitly sets the unloaded embedded field, consider it as an loaded one, if model is partially loaded * @see EMongoEmbeddedDocument::__set() */ public function __set($name, $value) { $return = parent::__set($name, $value); if ($this->_partial && !in_array($name, $this->_loadedFields)) { $this->_loadedFields[] = $name; if (count($this->_loadedFields) === count($this->attributeNames())) { $this->_partial = false; $this->loadedFields = null; } } return $return; }