G
G
grabbee2021-11-27 20:16:11
symfony
grabbee, 2021-11-27 20:16:11

How to make an optional entity in Symfony?

I'm making a bundle that uses an entity that doesn't exist. For tests, I defined it, but in the final version it should not be. More precisely, I do not know how to proceed

. There should be an opportunity to redefine the entity. The one that is by default, it is not required. But I can't figure out how to redefine or inherit it later so that this extra table is not created in the database in migrations.

---
I just want to highlight the common functionality for reuse. I made my authorization bundle using JWT token. To do this, two entities, User + UserToken - they have two repositories and entity managers. Autotrization, registration, token renewal, password recovery services. Controllers according to services.

I just want to connect this bundle and have everything set up by default right away. But if you register entities as usual, then they cannot be expanded. For example, in another project, you need to add several fields to the User - but this is simply not done in the Doctrine. And for the sake of one or two fields, I don’t want to fence associations.

Until I got to Interfaces. But when creating a User, the manager needs to register this entity. Pass just like User::class ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question