В чем разница между прокси, репозиториями и службами в Doctrine 2?

I am wondering what are the difference between those 3 patterns.

As far as I understand:

  • Proxies are used only for lazy-load entities
  • Repositories are used to add logic to your model (width some shortcut method for DQL statement)
  • Services are used to rely models and controllers

For this last, services, I don't the point behind it with a Doctrine 2 project as repository are not aware of the persistent system behind, because it use the ORM with DBAL.

I read that proxies could be used to add logic to entities, so what's the difference with repositories?

By the way, should my Entities only contain public getter/setter to their attribute and only that? Is it correct?

I'm kind of lost here.

Do you have any concrete example?

7
задан Mick 9 May 2013 в 04:31
поделиться