Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • MVC architecture in CakePHP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 367
    Comment on it

    CakePHP is a swift development framework for PHP which manipulate frequently recognized design patterns like Associative Data Mapping, Front Controller, and MVC. Our key target is to impart a structured framework that accredit PHP users at all levels to speedily develop resilient web applications, without any loss to pliability.

    CakePHP follows the MVC software design pattern. MVC Programming pattern will distinct the application into three Layers :


    • Model layer
    •  View layer
    •  Controller layer


    Model Layer

    The Model layer illustrate  one part of the application that executes the business logic. Models are depiction of database tables. They can connect to database, query it and save data to the database. If you want to work with the  MVC model its very essential to note that there must be no interaction between models and views.


    All the logic  part will be handled by controllers as it is responsible for collecting the data and then after transforming them into important concepts for the application by processing the data,validating the data, associating or other similar tasks related to handling data. In the MVC architecture Model is basically the first layer this layer interact with the controller with the help of the view .


    Controller act as a middle man between model and view. When you install the CakePHP in your system you will see that there app folder in the app folder there are various folders you will find the folder of model view and controller. In the Model folder you have the AppModel as default model you have to make your model with any name but the name is according to the naming conventions that we used in the CakePHP.


    View Layer

    You can report Views in the  template files that present their content to the user. Variables, arrays and objects that are used in the views layer of the MVC architecture are enroll with the help of controller.


    A presentation of  all the data will be contributed by the View. In the view we make our own folder with the proper naming convention all the files in the view folder will be saved with the help of .ctp extension. 


    View produces the presentational interface for the application that are utilizing the information that is available. The view layer is basically used for designing. This layer help in transferring the information between model and controller. 


    Controller Layer 

    Requests from the View layer are handled by the Controller layer. Controller mainly contains the logic of your application. Controller has the various functionalities,they can retrieve the data in the database and they can modify them by accessing database tables with the help of  models.


    They also use the variables and objects, that can be used in views. Controllers in the MVC act as managers it takes care that all needed resources that are needed for completing a task.


     They wait for response from clients, and then checks their validity according to the rules of authentication or authorization that are provided, processing to the model, and selects only the correct type of presentational data which are expected by the client ,to finally emissary this contributing the  process to the View layer.

    MVC architecture in CakePHP

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: