views:

16

answers:

1

I've found out that when I extends Zend_Db_Table_Abstract in my model I get

An Error Ocurred

Aplication error

When I run this code

<?php

class Admin_Model_News
{
    protected $_name = 'news';
    protected $_primary = 'new_id';

    public function addNews($data) {
        $this->insert($data);
    }
}

It works properly, but when I run

<?php

class Admin_Model_News extends Zend_Db_Table_Abstract
{
    protected $_name = 'news';
    protected $_primary = 'new_id';

    public function addNews($data) {
        $this->insert($data);
    }
}

It messes up What could be wrong? You can check some of my files here

+1  A: 

Wrap the insert in a try catch block:

try{
    $this->insert($data);
} catch (Exception $e){
    echo $e->__toString();
}

This will give you a more detailed error message then application error. AND PLEASE comment here if it doesnt work dont post a new question AGAIN.

Iznogood
It doesn't even call the addNews() method. If I wipe out the whole class, it still gives the error
Rodrigo Alves
I wraped it in the `$db = new Admin_Model_News();` and it said `No adapter found for Admin_Model_News` how do I solve this?
Rodrigo Alves
DO you initialise Zend_Db in your bootstrap with config from application.ini?
Iznogood
I'm using `resources.db.adapter = PDO_MYSQL` I thought it did automatically
Rodrigo Alves
No it doesnt. I guess you fixed it. If not just search here you will find plenty of example of bootstraping your db resource.
Iznogood