protected function castParameter($mappedClassName, $key, $value)
    {
        $parameter = $this->getSetterParameter($mappedClassName, $key);
        $parameterClass = $this->getParameterClass($parameter);
        if ($parameterClass) {
            $paramClassName = $parameterClass->getNamespaceName() . '\\' . $parameterClass->getName();
            if ($paramClassName === '\DateTime') {
                $value = new \DateTime($value);
            }
        }

        return $value;
    }