Created
May 30, 2012 09:09
-
-
Save tanakahisateru/2834833 to your computer and use it in GitHub Desktop.
Better AR with Yii - 1
This file contains 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 FooController extends Controller { | |
public function actionIndex() | |
{ | |
// showing newer Foo models. | |
$this->render('index',array( | |
'dataProvider' => new CActiveDataProvider( | |
'Foo', array( | |
'criteria'=>array( | |
'order'=>'created_on DESC', | |
// Bad MVC because SQL semantic is in controller. | |
), | |
) | |
), | |
)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment