0

I have been working on a number of PHP projects (web site, polling scripts, AMQP services, etc) and all are related to each over so there is some overlap in the database schema. So far i've been using Doctrine DBAL to both generate my schema (using SchemaManager) and for data access through (non-ORM) entity and repository classes.

My question is regarding finding a better practice for storing/sharing the database related objects around my platform.

For example the web site side of the project currently contains the schema for several required tables which provides the benefit of building my tables automatically when i boot up another instance server. In a separate project i have built a monitoring service and in that project defined the tables required to store the settings. This all seems fine however i now wish to build an admin page on the web site which allows me to update the records in the monitor service tables.

I don't really want to include the monitor system code into the web site code base (via composer) just to share the repositories and schema so i'm looking for ideas on a better arrangement.

My first idea is to create a separate "shared-schema" project which includes system-wide database classes so all my schema files and repositories and entities live in a single location however i'm not sure if this is at all sensible. My concern is that if i'm loading this in to all projects via composer then i'm going to end up having to update several projects every time i change something in the schema etc.

Please let me know if you have any specific questions or advice on how best to deal with this kind of situation.

Thanks

puppyFlo
  • 445
  • 4
  • 16
  • Maybe you have time to build up a basic API to interact with the shared DB: behind the scenes you'll have your "shared-schema" project, everything in one place, and every project connecting to it will do so using a basic class that will communicate with the API. Security based on DB credentials for starters, eventually making it stronger with system-managed ACLs for production environments. Hope it'll help! :) – Stock Overflaw Oct 20 '14 at 09:23
  • That's great my friend - thank you. As an old (tumbleweed) post I've actually already made a change to resolve the issue. I've decided that although Doctrine schema management is brilliant for smaller applications, in this case i've outgrown it. To resolve I've created a separate schema project as pure SQL. Going forward there may be a requirement to centralise the repository classes as you've suggested but for now the solution seems tight! Appreciate the response, have a good day. – puppyFlo Oct 20 '14 at 14:58

0 Answers0