What the hell is this layer, see the next thinkphp and symfony all have this gratitude, but the service of the two frameworks make people understand as if completely two different things.
I understand that the Symfony service is a variety of third-class libraries, and thinkphp I understand that he is equivalent to each C and M of the middle tier, each control will be to the serivce. Really a little confused, ask the great God to give guidance?
Reply content:
What the hell is this layer, see the next thinkphp and symfony all have this gratitude, but the service of the two frameworks make people understand as if completely two different things.
I understand that the Symfony service is a variety of third-class libraries, and thinkphp I understand that he is equivalent to each C and M of the middle tier, each control will be to the serivce. Really a little confused, ask the great God to give guidance?
What I've been doing recently is just the thinkphp 3.2.x version; As for Symfony not very familiar with some of the libraries, so it is not caught dead.
As I understand it, the service in TP can be understood as the API, not like the LZ understanding of C and M of the middle tier, the M layer is used to interact with the database, and the service is not limited to this, the role is to provide the controller or other things a standardized "service" Interface for use (service).
For example, "user""department" two model, respectively, corresponding to its curd operation of the data table. "userservice" provides "authroize", "get_department", "is_authenticated" and other "service Interfaces". It is nothing more than the original model to do more detailed separation, including the TP logic is the same, although not how to use it.
SF First answer, caught dead.
Above
This means that so far, the size of your project has been small, MVC basically fits your needs, and when your project size or complexity goes up, you will naturally have the serivce layer of demand.
With @ old FA Hai said
Symfony2 called service Container (Services container), server capacity and service in thinkphp is an idea, but there are some differences:
The thinkphp usually have these layers:
Controller
Model
View
Service
...
These layers are in the Symfony2:
Controller
Entity
Repository
View
Manager
The manager in Symfony2 is not required, basically and the service in thinkphp is a thing that is between the Controller and model (repository), and the service container is built on the Manager A service.