/** * Merges data received from the server. * * @param array $data Data retrieved from server. * @param bool $completeData Fetch all data or not. */ private function mergeFromServer($data, $completeData = true) { $this->hasBeenFetched = $this->hasBeenFetched || $completeData ? true : false; $this->_mergeMagicFields($data); foreach ($data as $key => $value) { if ($key === '__type' && $value === 'className') { continue; } $decodedValue = ParseClient::_decode($value); if (is_array($decodedValue)) { if (isset($decodedValue['__type'])) { if ($decodedValue['__type'] === 'Relation') { $className = $decodedValue['className']; $decodedValue = new ParseRelation($this, $key, $className); } } if ($key == 'ACL') { $decodedValue = ParseACL::_createACLFromJSON($decodedValue); } } $this->serverData[$key] = $decodedValue; $this->dataAvailability[$key] = true; } if (!$this->updatedAt && $this->createdAt) { $this->updatedAt = $this->createdAt; } }