SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | ||
| 3 | class Application_Model_Albums extends Zend_Db_Table_Abstract | |
| 4 | {
| |
| 5 | - | protected $bootstrap; |
| 5 | + | protected $_name = 'albums'; |
| 6 | - | protected $db; |
| 6 | + | protected $_primary = 'id'; |
| 7 | - | //protected $_name = 'albulms'; |
| 7 | + | |
| 8 | - | //protected $_primary = 'id'; |
| 8 | + | } |
| 9 | ||
| 10 | - | //public $db; |
| 10 | + | class Application_Model_Album |
| 11 | {
| |
| 12 | ||
| 13 | - | function __construct(){
|
| 13 | + | |
| 14 | - | |
| 14 | + | |
| 15 | - | /*$this->db = Zend_Db::factory('Pdo_Mysql', array(
|
| 15 | + | |
| 16 | - | 'host' |
| 16 | + | $albums = new Application_Model_Albums(); |
| 17 | - | => 'localhost', |
| 17 | + | $albumList = $albums->fetchAll( |
| 18 | - | 'username' => 'root', |
| 18 | + | $albums->select() |
| 19 | - | 'password' => 'monkey12', |
| 19 | + | ->where('id > ?', 1)
|
| 20 | - | 'dbname' |
| 20 | + | ); |
| 21 | - | => 'zend_test')); |
| 21 | + | return $albumList; |
| 22 | - | $this->db = $resource->getDbAdapter();*/ |
| 22 | + | |
| 23 | - | $this->bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
|
| 23 | + | |
| 24 | - | $this->db = $this->bootstrap->getResource('db');
|
| 24 | + | class AlbumsController extends Zend_Controller_Action |
| 25 | {
| |
| 26 | public function testAction() | |
| 27 | {
| |
| 28 | $albums = new Application_Model_Album(); | |
| 29 | $this->view->results = $albums->getAlbums(); | |
| 30 | - | /*$sql = 'SELECT * FROM albulms'; |
| 30 | + | |
| 31 | - | $results = $this->db->fetchAll($sql); |
| 31 | + | } |
| 32 | - | return $results;*/ |
| 32 | + | |
| 33 | - | |
| 33 | + |