পৃষ্ঠাসমূহ

.

Search Your Article

Total Pageviews

Wednesday, March 8, 2017

Phalcon - Functionality

Model View Controller (MVC) is a software design and structural pattern for developing webbased applications. This software architectural separates the representation of information from the user's interaction with it.

The MVC model defines the web applications with three logic layers.
MVC

Model

Models are objects which represent knowledge. There should be a one-to-one relationship between the model and its parts. It includes all the logic to be used for database connectivity and performing CRUD operations.

View

A view is a visual representation of its model. View interacts with the model or its parts and gets the data necessary for the presentation from the model. This is achieved by sending requests and receiving appropriate responses. View includes all the data that end user sees.

Controller

A controller acts as the intermediary between the user and the system (model and view). It accepts the request from the user, through the view sends it to the model. The model manipulates it and sends the response to the controller, which is displayed as the output to the end user through view.
The controller receives such user output and translates it into the appropriate messages. These messages are used by view to display as appropriate responses.

Workflow in Phalcon

The workflow in Phalcon is as follows −
  • The user interacts with the user interface (view) and the interaction is maintained with the help of some method/event.
  • These methods and events are handled by the controller.
  • The controller accesses the model by updating the user’s action.
  • View uses the model to generate an appropriate output.
  • View fetches data from its model. The model has no direct interaction with view.
  • The user interface waits for further user interactions, which starts with a new cycle of request and response.
Workflow Phalcon includes directories for Model, View, and Controller. The following screenshot gives a better scenario.
Directories All business logic is described in the controller, and the model interacts with the database which includes all files with respect to each and every table.
Note
  • All the controllers created in Phalcon web application extends Phalcon\Mvc\Controller.
  • All the models associated with the database tables extends \Phalcon\Mvc\Model.

No comments:

Post a Comment