O'Reilly logo

Web Application Development with Yii 2 and PHP by Jeffrey Winesett, Mark Safronov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making the data and application layers

Now, let's get started on the real work.

To satisfy our end-to-end test, we can start from many different levels of our application. But as we already know we will work with Yii, let's figure out what we should do in the controller.

We need to provide two routes: /customers/add and /customers. Here is the controller declaration we need for them:

namespace app\controllers;
use yii\web\Controller;

class CustomersController extends Controller

Obeying the default settings, route /customers equals to the route /customers/index. We need to provide the method named actionIndex to enable this route.

What will we do in this route? Our intention is to provide a list of customers recorded in the database. We have a separate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required