Esempio n. 1
0
 /**
  * @param array $values
  *
  * @param object|null $model
  *
  * @return object
  */
 public function hydrate(array $values, $model = null)
 {
     $model = $model ?: $this->create();
     if (isset($values['_id'])) {
         $values['_id'] = (string) $values['_id'];
     }
     set_object_values($model, $values);
     return $model;
 }
Esempio n. 2
0
 /**
  * @param string      $key
  * @param object|null $object
  */
 protected function setObject($key, $object)
 {
     unset_value($key, $this->values, $this->changedValues);
     unset_value($key, $this->objects);
     if ($object) {
         set_value($key, get_object_values($object), $this->values, $this->changedValues);
         $values =& get_value($key, [], $this->values);
         set_object_values($object, $values, true);
         set_value($key, $object, $this->objects);
     }
 }