title: Best Practices for developing a multi-tenant application with Symfony2 and Doctrine2
body: <p>I am working on an application that needs to support the multi-tenant model.  I am using the symfony2 php framework and doctrine2. </p>
  
  <p>I'm not sure the best way to go about architecting this requirement.  Does Symfony's ACL functionality provide a part of the solution?  </p>
  
  <p>What recommendations or ideas could you provide? Are there any sample symfony2 applications or open source applications that are available which have implemented this strategy? </p>
  
  <p>My first thought is to use a tenant_id column in all the tables and have this relate to the account object in the application. I'm not sure though if ACL is supposed to take care of what i'm wanting to do, or if your still responsible for all of the queries against your objects so they don't return un-authorized data. </p>
  
  <p>If I wasn't using Doctrine, it might be easy to say just append <code>Where tenant_id = @accountid</code> to each query, but i'm not sure that is the right approach here. </p>
  
  <p>Thanks </p>