/** * Updates an existing record. Merges with existing data. * Use {@link set()} to unset values. * * @param String $type * @param String $key * @param FakeObject $obj */ public function update($type, $key, FakeObject $obj) { $existing = $this->get($type, $key); $record = $existing ? array_merge($existing->toArray(), $obj->toArray()) : $obj->toArray(); $data = $this->getData(); if (!isset($data[$type])) { $data[$type] = array(); } $data[$type][$key] = $record; $this->setData($data); // $this->log(sprintf( // 'Update fake %s#%s: %s', // $type, // $key, // json_encode($record) // )); }