/**
  * @param array $value
  *
  * @return array
  */
 protected function preSerialization(array $value)
 {
     /** @var \NilPortugues\Api\Mapping\Mapping $mapping */
     foreach ($this->mappings as $class => $mapping) {
         RecursiveFilterHelper::deletePropertiesNotInFilter($this->mappings, $value, $class);
         RecursiveDeleteHelper::deleteProperties($this->mappings, $value, $class);
         $this->buildValidPropertyAlias($mapping);
         RecursiveRenamerHelper::renameKeyValue($this->mappings, $value, $class);
     }
     return $value;
 }
Пример #2
0
 /**
  * @param array $value
  *
  * @return mixed
  */
 protected function serializeObject(array $value)
 {
     if (null !== $this->mappings) {
         /** @var \NilPortugues\Api\Mapping\Mapping $mapping */
         foreach ($this->mappings as $class => $mapping) {
             RecursiveDeleteHelper::deleteProperties($this->mappings, $value, $class);
             RecursiveRenamerHelper::renameKeyValue($this->mappings, $value, $class);
         }
     }
     $this->setResponseMeta($value);
     $this->setResponseLinks($value);
     self::formatScalarValues($value);
     RecursiveDeleteHelper::deleteKeys($value, [Serializer::CLASS_IDENTIFIER_KEY]);
     self::flattenObjectsWithSingleKeyScalars($value);
     $this->recursiveSetKeysToUnderScore($value);
     return $value;
 }
Пример #3
0
 /**
  * @param array $value
  *
  * @return array
  */
 protected function transformUnmappedObjectsToArray(array $value)
 {
     return RecursiveRenamerHelper::serializedObjectToArray($value, $this->mappings);
 }