Many Tables with the same schema

I have a need to have many tables, all with the same schema. Imagine many Customers, and each Customer has Products - lots of them - far too many to put in a single table.

What I want to avoid is having to bake a lot of model code for each table. So basically I want to reuse the Entity and Table classes for all the database tables. Way I see I have 2 options:

  1. One database with many tables. The table names would be prefixed. For example customer1_products / customer2_products.
  2. Many databases with 1 table, all the tables have the same name.

Which option would play nicest with Cake? I want to keep things as simple as possible and avoid duplicate code in my app.

You want to create a separate products table for each customer? Why not just have a single products table with a customer ID column in it that tells you which customer the product belongs to? That’s the standard approach.

Thanks for your reply. I fully get what you are saying, but it’s not an option in this case.

Im just asking if anyone has any previous experience working with my kind of requirements and can offer any advice on the approaches I am thinking.

I guess the same connection but different DB prefixes works easiest
No connection switching needed, only different instances of the table class with a custom table name then.

Thanks. I’ll probably try both approaches, as well as a combined approach when I properly get round to this work.