I'm developing an application and I'm handling the database things
with Zend_Db_Table and now I met a very strange error. I'm not able to
decide I did something wrong or Zend_Db became stupid.
Here is my class:
class SayCMS_Modules_Movieslibrary_Table_MovieDubTypes
extends Zend_Db_Table_Abstract {
protected $_name = 'saycms_modules_movieslibrary_table_moviedubtypes';
protected $_primary = 'moviedubtype_id';
//if you have serial or auto increment comment out
protected $_sequence = true;
}
In an another file I put into Zend_Registry:
Zend_Registry::set('SayCMS_Modules_Movieslibrary_Table_MovieDubType',
new SayCMS_Modules_Movieslibrary_Table_MovieDubTypes());
In the controller I'm inserting data like this:
public function addnewmoviesdubtypesAction() {
$params = $this->_getAllParams();
if($params['newmoviesdubtypename'] == '') {
$this->view->message = 'error';
} else {
$movieDubtypesTable =
Zend_Registry::get('SayCMS_Modules_Movieslibrary_Table_MovieDubType');
if($params['note'] != '') {
$noteTable =
Zend_Registry::get('SayCMS_Modules_Movieslibrary_Table_Notes');
$noteArray = array('note_id' => null, 'note' => $params['note']);
$noteLastInsertId = $noteTable->insert($noteArray);
} else {
$noteLastInsertId = null;
}
$moviedubtypeInsertArray = array(
'moviedubtype_id' => null,
'moviedubtype_name' => $params['newmoviesdubtypename'],
'note_id' => $noteLastInsertId);
$movieDubtypesTable->insert($moviedubtypeInsertArray); //this
row makes the error
$this->view->message = 'success';
}
}
The signed row error this:
Fatal error: Uncaught exception 'Zend_Db_Statement_Exception' with
message 'SQLSTATE[42P01]: Undefined table: 7 ERROR: relation
"saycms_modules_movieslibrary_table_moviedubtypes_moviedubtype_i" does
not exist' in /mnt/ware/PRIVAT/PROJECTS/saycms_on_php/lib/Zend/Db/Statement/Pdo.php:238
Stack trace: #0
/mnt/ware/PRIVAT/PROJECTS/saycms_on_php/lib/Zend/Db/Statement.php(283):
Zend_Db_Statement_Pdo->_execute(Array) #1
/mnt/ware/PRIVAT/PROJECTS/saycms_on_php/lib/Zend/Db/Adapter/Abstract.php(430):
Zend_Db_Statement->execute(Array) #2
/mnt/ware/PRIVAT/PROJECTS/saycms_on_php/lib/Zend/Db/Adapter/Pdo/Abstract.php(220):
Zend_Db_Adapter_Abstract->query('SELECT NEXTVAL(...', Array) #3
/mnt/ware/PRIVAT/PROJECTS/saycms_on_php/lib/Zend/Db/Adapter/Abstract.php(734):
Zend_Db_Adapter_Pdo_Abstract->query('SELECT NEXTVAL(...', Array) #4
/mnt/ware/PRIVAT/PROJECTS/saycms_on_php/lib/Zend/Db/Adapter/Pdo/Pgsql.php(275):
Zend_Db_Adapter_Abstract->fetchOne('SELECT NEXTVAL(...') #5
/mnt/ware/PRIVAT/PROJECTS/saycms_on_php/lib/Zend/Db/Table/Abstract.ph
in /mnt/ware/PRIVAT/PROJECTS/saycms_on_php/lib/Zend/Db/Statement/Pdo.php
on line 238
The really strange thing that I don't know the class how the hell make
this table name:
"saycms_modules_movieslibrary_table_moviedubtypes_moviedubtype_i". It
looks like for me put together the table name and the primary key. But
in this case where is the "d" letter?
I'm using this solution another places in my application and
everything working fine.
I'm using ZF-1.7. I know I should upgrade...
I appreciate your kind help!
András
--
- -
-- Csanyi Andras -- http://sayusi.hu -- Sayusi Ando
-- "Bízzál Istenben és tartsd szárazon a puskaport!".-- Cromwell
没有评论:
发表评论