Archive table implementation with Symfony 4 and Doctrine 2

Viewed 635

I read about some arguments on Soft delete vs. Archive table which led me to this question.

I thought I could implement an entity Product which is mapped to two identical tables Product and ArchivedProduct, but there is a known limitation of Doctrine 2

Mapping many tables to one entity It is not possible to map several equally looking tables onto one entity. For example, if you have a production and an archive table of a certain business concept then you cannot have both tables map to the same entity.

So I thought I could use two entities, Product and ArchivedProduct, that are mapped to the same table, but it led to another problem that the One-to-Many reference $products in the entity Category should be mapped to two different entities.

Should I use Inheritance Mapping on Product and ArchivedProduct? What's the best practice of Archive table with Symfony 4 and Doctrine 2?

0 Answers
Related