Tuesday, November 18, 2014

#codingexercise

Int GetCountDuplicatesAvg (int [] A)

{

if (A == null) return 0;

return A.CountDuplicatesAvg();

}

In this post, we continue to read about PHP MVC pattern. A controller handles the logic usually for a single model. In Cake, the controller names are always plural.  Generally each controller extends the AppController.
Methods include the following:
<?php
class SharesController extends AppController
{
        function view($id)
        {
        }
        function create($path)
        {
        }
        function search($query)
        {
        }
}
postConditions is used to format this data to use in the model.
ControllerVariables are a few special variables inside of the controller such as $name,  $uses, $helpers, $layout, $autoRender, $beforeFilter , $components etc.
ControllerParameters are available via $this->params in the current controller.

Cake follows a naming convention for models, views and controllers.

The Models are usually named singular and scaffolding is available for database.  The standard way of getting to the data using a model include
findAll
string $conditions
array $fields
string $order
int $limit
int $page
int $recursive

No comments:

Post a Comment