Skip to content

Instantly share code, notes, and snippets.

@tanakahisateru
Created May 30, 2012 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanakahisateru/2834833 to your computer and use it in GitHub Desktop.
Save tanakahisateru/2834833 to your computer and use it in GitHub Desktop.
Better AR with Yii - 1
<?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