Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatible with entity that extends another one ? #383

Open
cesar-cardinale opened this issue Sep 19, 2023 · 0 comments
Open

Compatible with entity that extends another one ? #383

cesar-cardinale opened this issue Sep 19, 2023 · 0 comments

Comments

@cesar-cardinale
Copy link

cesar-cardinale commented Sep 19, 2023

Subject

Is this bundle compatible with child entity that are extending a parent one ?

Like this is my parent class :

#[ORM\MappedSuperclass]
#[ORM\Entity(repositoryClass: WidgetRepository::class)]
#[ORM\InheritanceType("SINGLE_TABLE")]
#[ORM\DiscriminatorColumn(name: "type", type: "string")]
#[ORM\DiscriminatorMap([
    'accordion_vertical_widget' => AccordionVerticalWidget::class,
])]
abstract class Widget implements TranslatableInterface
{
   use TranslatableTrait;
   ...
   private string $title;
   private string $type;
}

And here is my child class :

#[ORM\Entity]
class AccordionVerticalWidget extends Widget implements TranslatableInterface
{
    use TranslatableTrait;
    private string $content;
    ...
}

The problem is that I have just a WidgetCrudController and not a controller for each WidgetType. Then, when I have a field that is only specified for the child and not in the parent, I can't get the auto-generated edit from using the form builder. Because it's said that the parent class (WidgetTranslation) doesn't have the attribute ($content) that I want to set in the child one (AccordionVerticalWidget) of the main class (Widget).

And the parent attributes can be translated, no problem for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant