Open
Description
Description
I would like to use API Platform alongside the Tenancy package. The concept behind Tenancy is simple. There are two types of databases (applications):
- A central database, which stores the list of all tenants (along with other non-tenant-dependent data).
- Multiple tenant databases, where tenant-specific data is stored.
Based on the request, we determine which database should be used for tenant-specific models. And here lies the problem: API Platform only recognizes the structure of the central database at startup and caches the model attributes. As a result, it cannot find the attributes for tenant models.
It seems to work only if the tenant database is a subset of the central database. This means I need to generate all tenant tables in the central database as well and then switch to the tenant database at request time. However, this feels more like a workaround rather than an ideal solution.