2010年6月2日星期三

Re: [fw-db] Zend_Db_Table_Exception : "A table must have a primary key, but none was found"

Then I don't see the reason for Zend_Db_Table to throw exception. Might that be a bug?

Regards,
Saša Stamenković


On Wed, Jun 2, 2010 at 1:49 PM, Petar Dzhambazov <jamby77@gmail.com> wrote:
Hi,
If you set

protected $_primary = 'your_primary_key';

it is not being checked if it is really the private key. So if it fits your needs you can set any filed of the table to be used as primary key.

regards
Petar


On 06/02/2010 02:19 PM, Саша Стаменковић wrote:
But what if table have no primary key?

Regards,
Saša Stamenković


On Wed, Jun 2, 2010 at 12:53 PM, Hilmar Hallbjörnsson <zormoni@gmail.com
<mailto:zormoni@gmail.com>> wrote:

   Hi.

   Normally, what you need in your class is this variable:

   protected $_primary = 'your_primary_key';  OR

   protected $_primary = array( 'primary_1', 'primary_2' .....);

   This error might occur when the model cannot detect the primary key,
   often it's because you have more than one.

   --Best regards and good luck
   Hilmar

   2010/5/25 zamanphp <zamanphp@gmail.com <mailto:zamanphp@gmail.com>>



       hi all
       I'm using Zend_Cachefor Zend_Db_Table_Abstract
       Sometimes Htay following occurs:
       "A table must have a primary key, but none was found"
       While I'm have in the my table primary key.
       and Refresh the page to be resolved
         What Is Problem؟

       --
       View this message in context:
       http://zend-framework-community.634137.n4.nabble.com/Zend-Db-Table-Exception-A-table-must-have-a-primary-key-but-none-was-found-tp2230044p2230044.html
       Sent from the Zend DB mailing list archive at Nabble.com.





没有评论: