Skip to content

Typed Properties and default column/association types #7939

@beberlei

Description

@beberlei

Feature Request

Q A
New Feature yes
RFC no
BC Break no

Summary

When declaring a type on a property, this should act as a default for field type or ManyToOne/OneToOne targetEntity.

class User
{
    /** @ORM\Column */
    public int $id; // defaults to type="integer"

   /** @ORM\ManyToOne */
   public Email $email; // defaults to targetEntity=Email::class
}

The relevant code would be in ClassMetadataInfo::mapField, mapManyToOne and mapOneToOne. Whenever type or targetEntity is missing, it could look this up in reflection property instead if it has a type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions