/** * * * @return void */ public function mergeDictionary(MDictionary $dictionary) { foreach ($dictionary->allKeys()->toArray() as $key) { $object = $dictionary->objectForKey($key); $this->setObjectForKey($key, $object); } }
/** * @internal * * @return MDictionary */ protected function unpackData(MDictionary $data, MEntityDescription $entity) { $unpackedData = new MMutableDictionary(); foreach ($data->allKeys()->toArray() as $key) { $value = $data->objectForKey($key); $unboxedValue = null; if (!is_null($value)) { $property = $entity->attributeWithName($key); if ($property->type() == MEntityDescriptionProperty::StringType) { $unboxedValue = $value->stringValue(); } else { if ($property->type() == MEntityDescriptionProperty::IntegerType) { $unboxedValue = $value->intValue(); } else { if ($property->type() == MEntityDescriptionProperty::FloatType) { $unboxedValue = $value->floatValue(); } else { if ($property->type() == MEntityDescriptionProperty::BooleanType) { $unboxedValue = $value->boolValue(); } else { if ($property->type() == MEntityDescriptionProperty::DateType) { $unboxedValue = $value->timestamp(); } else { if ($property->type() == MEntityDescriptionProperty::BinaryType) { $unboxedValue = $value->getBytes(); } } } } } } } $unpackedData->setObjectForKey($key->stringValue(), $unboxedValue); } return $unpackedData; }