We are creating a SaaS that monitors certain assets. This means it takes in data, saves it, and displays it in a webinterface.
For this, we have a few components that we created with/are moving to Symfony2:
- a frontend web application, where users can view their data
- a backend administrative web application, where we create new monitors, users, etc.
- an API
- an application that retrieves the received data from a queue and puts it in our database (this is now a seperate script, but I'm thinking of reworking this as a Symfony command that is called by cron)
All these four applications share the same model: our main database that holds all the users, monitors, and data.
My question is: how should I structure these projects in Symfony2?
- Do I create a seperate bundle which holds the entities for my database, and have the four projects include those entities and work with them?
- Can I make a 'model' directory in my Symfony app folder, which is used by all the bundles in my /src directory?
- Some other, cleaner way to do this?
Option 1 seems a bit weird, since a bundle, to my understanding, needs routing, views, controllers, etc. Using it for just entities would be a bit weird.
Option 2 seems alright, since the /app folder is considered 'communal' anyway for everything that is in the /src folder (since, for example, parameters reside there as well). However, there is no 'model' folder there, and I'm not sure that there should be?
I understand that there are very few 'best practices' out already for Symfony 2, since it's brand new. But I wanted to see if there are any practices more preferable then others, in your opinion.
Any feedback is more then welcome. Thanks in advance,
Dieter