PhalconRest\Transformers\ModelTransformer::transform PHP Method

transform() public method

public transform ( $item )
    public function transform($item)
    {
        if ($item == null) {
            return null;
        }
        $result = [];
        $keyMap = $this->keyMap();
        foreach ($this->getResponseProperties() as $property) {
            $fieldName = array_key_exists($property, $keyMap) ? $keyMap[$property] : $property;
            $result[$fieldName] = $this->getFieldValue($item, $property, $fieldName);
        }
        $combinedResult = array_merge($result, $this->additionalFields($item));
        return $combinedResult;
    }