Use single entity and map it to multiple tables (dynamically set table name) #5380

Closed
opened 2026-01-22 15:05:58 +01:00 by admin · 1 comment
Owner

Originally created by @noisemaker00 on GitHub (Jan 12, 2017).

Originally assigned to: @lcobucci on GitHub.

I need to map a single entity (eg: CustomersOrdersY.php) to a multiple table, on the base of the year. Inside my class there's a field wich contains the year and I need to save record in the corrisponding table.
Example:
If the year in the class object was set to 2016 I need to save entity in: "customers_orders_2016"

Is that possible with the framework?

Originally created by @noisemaker00 on GitHub (Jan 12, 2017). Originally assigned to: @lcobucci on GitHub. I need to map a single entity (eg: CustomersOrdersY.php) to a multiple table, on the base of the year. Inside my class there's a field wich contains the year and I need to save record in the corrisponding table. Example: If the year in the class object was set to 2016 I need to save entity in: "customers_orders_2016" Is that possible with the framework?
admin added the InvalidQuestion labels 2026-01-22 15:05:58 +01:00
admin closed this issue 2026-01-22 15:05:58 +01:00
Author
Owner

@lcobucci commented on GitHub (Jan 12, 2017):

@noisemaker00 that's not supported since it's not the responsibility of an ORM.

I assume that you want to do that because your data increased a lot and everything is slow... if that is the problem you can try to use table partitioning to solve it, like this for MySQL.

@lcobucci commented on GitHub (Jan 12, 2017): @noisemaker00 that's not supported since it's not the responsibility of an ORM. I assume that you want to do that because your data increased a lot and everything is slow... if that is the problem you can try to use table partitioning to solve it, like [this for MySQL](http://dev.mysql.com/doc/refman/5.7/en/partitioning-overview.html).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5380