Open
Description
Feature Request
Q | A |
---|---|
New Feature | yes |
RFC | yes |
BC Break | no |
Summary
In metadata, the default type of fields is string
, regardless of the type of field property. I propose to inspect the property types when the field type is not defined. The would only support simple types (maybe with extension point):
property | field |
---|---|
int | int |
string | string |
float | float |
DateTime | date |
DateTimeInterface | date_immutable |
DateTimeImmutable | date_immutable |
ObjectId | object_id |
Benefit: no need to declare the field type.
Usage
#[Document]
class User
{
#[Id]
public string $id;
#[Field]
public string $name;
#[Field]
public DateTimeImmutable $createdAt;
#[Field]
public int $level;
}