api-platform / schema-generator

PHP Model Scaffolding from Schema.org and other RDF vocabularies
https://api-platform.com/docs/schema-generator/
MIT License
458 stars 108 forks source link

DoctrineOrmAttributeGenerator - dateTime resolving to datetime not date type #393

Closed PawelSuwinski closed 2 years ago

PawelSuwinski commented 2 years ago

DateTime type is resolved to Doctrine ORM date type by attribute generator, what I think is a bit unexpected (?).

# config/schema.yaml
(...)
      createdAt:
        range: "https://schema.org/DateTime"

gives:

(...)
    #[ORM\Column(type: 'date', nullable: true)]
    #[Assert\Type(\DateTimeInterface::class)]
    private ?\DateTimeInterface $createdAt = null;

instead:

    #[ORM\Column(type: 'datetime', nullable: true)]
    #[Assert\Type(\DateTimeInterface::class)]
    private ?\DateTimeInterface $createdAt = null;
alanpoulain commented 2 years ago

Thanks @PawelSuwinski.