This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Hoge extends CActiveRecord | |
{ | |
public $username; // 追加 | |
... | |
/** | |
* @see CModel::rules() | |
*/ | |
public function rules() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $this->widget('zii.widgets.grid.CGridView', array( | |
'id' => 'hoge-grid', | |
'dataProvider' => $model->search(), | |
'filter' => $model, | |
'columns' => array( | |
'id', | |
array( | |
'name' => 'username', | |
'value' => '$data->user->username', | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class HogeController extends Controller | |
{ | |
public function actions() | |
{ | |
return array( | |
'edit' => array( | |
'class' => 'application.components.actions.EditAction' | |
), | |
'delete' => array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class HogeController extends Controller | |
{ | |
public function actions() | |
{ | |
return array( | |
'edit' => array( | |
'class' => 'actions.EditAction', | |
//'class' => 'EditAction', // import に追加している場合 | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Hoge extends CActiveRecord | |
{ | |
... | |
/** | |
* @see CActiveRecord::scopes() | |
*/ | |
public function scopes() | |
{ | |
return array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class HogeController extends Controller | |
{ | |
/** | |
* Lists all models. | |
*/ | |
public function actionIndex() | |
{ | |
list($pages, $models) = Hoge::model()->getAll(); | |
$this->render('index', compact('pages', 'models')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $this->widget('CLinkPager', compact('pages')); ?> | |
<?php echo CHtml::encode('結果数: ' . $pages->itemCount . ' 件'); ?> | |
<?php foreach ($models as $model): ?> | |
<div class="view"> | |
<?php echo CHtml::encode($model->fuga); ?> | |
<?php echo CHtml::encode($model->piyo); ?> | |
<br /> | |
</div><!-- /.view --> | |
<?php endforeach; ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
'components' => array( | |
'db' => array( | |
'enableProfiling' => true, // 追加 | |
... | |
), | |
'log' => array( | |
'class' => 'CLogRouter', | |
'routes' => array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UpdateAction extends CAction | |
{ | |
/** | |
* リダイレクト先 | |
*/ | |
public $redirect = 'view'; | |
public function run($id) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class HogeController extends Controller | |
{ | |
... | |
public function actions() | |
{ | |
return array( | |
// アクション名を指定 ( actionUpdateとなる ) | |
'update' => array( | |
'class' => 'application.components.actions.UpdateAction', // パス名指定 |
OlderNewer