Skip to content

Instantly share code, notes, and snippets.

@bladeofsteel
Created April 22, 2011 09:48
Show Gist options
  • Save bladeofsteel/936363 to your computer and use it in GitHub Desktop.
Save bladeofsteel/936363 to your computer and use it in GitHub Desktop.
<?php
class Application_Model_Posts
{
public function getPosts()
{
$posts = new Application_Model_DbTable_Posts();
$select = $posts->select()->order('created_at DESC')
->order('id DESC');
return $posts->fetchAll($select);
}
}
class IndexController extends Zend_Controller_Action
{
...
public function indexAction()
{
// Создаем экземпляр модели постов
$posts = new Application_Model_Posts();
// Выполняем запрос
$this->view->posts = $posts->getPosts();
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment