private function normalizeValue(ClassMetadata $metadata, $property, $value)
    {
        if (self::PARAMETER_ID_KEY === $property) {
            return $this->getFilterValueFromUrl($value);
        }

        if (self::PARAMETER_NULL_VALUE === $value) {
            return null;
        }

        switch ($metadata->getTypeOfField($property)) {
            case 'boolean':
                return (bool) $value;

            case 'integer':
                return (int) $value;

            case 'float':
                return (float) $value;

            case 'datetime':
                // the input has the format `2015-04-28T02:23:50 00:00`, transform it to match the database format
                // `2015-04-28 02:23:50`
                return preg_replace('/(\d{4}(-\d{2}){2})T(\d{2}(:\d{2}){2}) \d{2}:\d{2}/', '$1 $3', $value);
        }

        return $value;
    }