2011-06-05 71 views
1

我與教義有點問題。即時得到以下錯誤:學說 - PHP致命錯誤:'無法獲取最後一個插入標識符'。

PHP Fatal error: Uncaught exception 'Doctrine_Connection_Exception' with message 'Couldn't get last insert identifier.' 

我看了這個帖子,Doctrine Problem: Couldn't get last insert identifier,這是有益的,但我的問題是有點不同。

我在不應該有一個auto_increment主鍵的表上收到此錯誤。我的設置如下:

Event: 
    id:int, PK, auto_increment 

User 
    id: int, PK, auto_increment 

UserEvent: 
    user_id:int, PK 
    event_id: int, PK 

我遇到了插入到UserEvent的問題。所以流程是,我在Event中插入一條記錄,然後向User中插入一條記錄,然後向UserEvent中插入一條記錄。

有趣的是,它插入所有這3個罰款。但插入最後一個(UserEvent)後,它會引發該錯誤。

任何想法?

+0

有人對此有任何建議嗎? – djt 2011-06-07 18:19:48

回答

1

想通了 - 在YML模式,UserEvent.user_id和UserEvent.event_id沒有屬性 - 主:真

一旦我做到了,並重新生成的模型,誤差走

相關問題