Skip to content

RFC: annotation to skip a field in entity #813

Closed as not planned
Closed as not planned
@andrewtch

Description

@andrewtch

Can we add an annotation like @Maker\Skip to entity fields so getters / setters are not regenerated with --regenerate --overwrite command?

The use case applies to Gedmo PersonalTranslations, for example. If you use it you have a field in your entities, $object, which is defined like so:

/**
     * @ORM\ManyToOne(targetEntity="App\Entity\Product", inversedBy="translations")
     * @ORM\JoinColumn(name="object_id", referencedColumnName="id", onDelete="CASCADE")
     */
    protected $object;

there are getters / setters without type in mapped superclass, so when maker bundle generates setObject(Product $object), it breaks inheritance.

Another option would be skipping getter / setter generation if there is one in parent class.

What do you think?

Edit: Oh, it seems like I've have had a similar issue with Traits couple years ago #181

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions