controller.php 625 Bytes
Newer Older
Qiang Xue committed
1 2
<?php
/**
Qiang Xue committed
3
 * This is the template for generating a controller class file.
Qiang Xue committed
4
 */
5

6 7 8 9 10
use yii\helpers\Inflector;

/* @var $this yii\web\View */
/* @var $generator yii\gii\generators\controller\Generator */

11
echo "<?php\n";
Qiang Xue committed
12 13 14
?>

<?php if (!empty($generator->ns)): ?>
Alexander Makarov committed
15
namespace <?= $generator->ns ?>;
Qiang Xue committed
16 17
<?php endif; ?>

Alexander Makarov committed
18
class <?= $generator->getControllerClass() ?> extends <?= '\\' . trim($generator->baseClass, '\\') . "\n" ?>
Qiang Xue committed
19
{
Alexander Mohorev committed
20
<?php foreach ($generator->getActionIDs() as $action): ?>
21 22 23 24
    public function action<?= Inflector::id2camel($action) ?>()
    {
        return $this->render('<?= $action ?>');
    }
Qiang Xue committed
25 26 27

<?php endforeach; ?>
}