Pasar al contenido principal

Symfony 6 User Deprecated: Method

User Deprecated: Method "Symfony\Component\Console\Command\Command::execute()" might add "int" as a native return type declaration in the future. Do the same in child class "App\Command\UpdateInfoCommand" now to avoid errors or add an explicit @return annotation to suppress this message

Argument #1 ($validateTo) must be of type DateTimeInterface, string given

En Symfony, al trabajar con propiedades o campos del tipo fecha en nuestra entidades, es posible que nos encontremos con este error:

App\Entity\Entidad::setValidateTo(): 
Argument #1 ($validateTo) must be of type DateTimeInterface, string given, 
called in /app/src/Command/UpdateEntidadInfo.php on line 50 

     Esto significa que aunque en nuestra entidad hemos declarado correctamente el tipo de propiedad, al intentar leerla desde otro lugar, sea controlador o comando de consola, tendremos que volver a añadir su tipo.