Question

Apologies for the fairly specific newbie question--at my wit's end as to why I can't get this to work.

I'm currently working through the Zend Framework 1 Tutorial (http://framework.zend.com/manual/1.12/en/learning.quickstart.create-model.html). I'm altering it a bit to make it fit the needs of a database storing information about birds, but very much using the tutorial as a guideline.

My problems are specifically arising at line 10 of guestbookMapper. I've added numerous html print statements throughout my code to determine where things were getting hung up. This line appears to be where things fall apart as the print statement before that line of code appears, but not the one after it.

My application.ini file has the following database connection information:

resources.db.adapter = "PDO_MYSQL"
resources.db.params.dbname = "BML"
resources.db.params.username = "BML"
resources.db.params.password = "<my password>"

I haven't specified the host because I don't know what value to put in here. I read that it wasn't necessary, but I'm skeptical. Please correct me if this is an invalid statement.

Inside the models directory, I have my Bird (equivalent to guestbook) and birdMapper (equivalent to guestbookMapper) as well as a DbTable directory. Inside this directory is my ClementsBirds.php which (should) correspond to my database table. My code inside this appears below:

class Application_Model_DbTable_ClementsBirds extends Zend_Db_Table_Abstract {
    print '<p> reached the database model </p>';
    protected $_name = 'clements6_8'; 
    protect $_primary = 'sort6_8';
}

I've printed out the value of $db_table before line 10 executes and its value is Application_Model_DbTable_ClementsBirds which I believe is correct.

Could someone please advise me as to where they think the problem is and how to fix it? I think it must be in my database connection not working properly, but I've followed the tutorial (and checked and rechecked my steps) so I'm not sure why this would be incorrect. That said, I did not use the script for creation of the database as my database already existed. Your help is very much appreciated!

No correct solution

OTHER TIPS

Its too late to answer this question. But hope it helps someone.

There is a mistake in the code. I don't know its typo in the question or actual mistake.

 protect $_primary = 'sort6_8';

The above line should be

 protected $_primary = 'sort6_8';
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top