2012-07-05 56 views
6

我正在使用FOSFacebookBundleFOSUserBundle以及Symfony2來管理我的用戶。我在本地有一切正常工作。但是,當我將所有內容都推送到暫存環境時,我注意到用戶在註冊時沒有被持久化(使用教條實體管理器)。聲明正在編寫但未執行

我檢查的第一件事是如果我可以使用實體管理器堅持其他的東西,這很好。接下來我去,並檢查日誌,發現插入語句有:

INSERT INTO user (username, username_canonical, email, email_canonical, enabled, salt, password, last_login, locked, expired, expires_at, confirmation_token, password_requested_at, roles, credentials_expired, credentials_expire_at, firstname, lastname, facebookID, date_of_birth, locale, gender, has_profile_pic, created_at, updated_at) 
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 
({"1":"1234","2":"1234","3":"[email protected]","4":"[email protected]","5":true,"6":"","7":"","8":null,"9":0,"10":false,"11":null,"12":null,"13":null,"14":["ROLE_FACEBOOK"],"15":0,"16":null,"17":"Mr","18":"Foo","19":"1234","20":{"date":"1986-12-09 00:00:00","timezone_type":3,"timezone":"PRC"},"21":"nl_NL","22":"male","23":1,"24":{"date":"2012-07-06 01:34:47","timezone_type":3,"timezone":"PRC"},"25":{"date":"2012-07-06 01:34:47","timezone_type":3,"timezone":"PRC"}}) 

當我更換問號,用事先準備好的聲明的價值和手動發出查詢,一切工作正常。

有沒有人有任何線索,這可能是什麼?我也會很高興提示如何進一步調試,因爲我不知道下一步去哪裏..

在此先感謝!

UPDATE:

我在MySQL日誌再多看一眼,我注意到,INSERT語句正在準備,但從來沒有執行(不像select語句)。我在錯誤日誌中找不到任何錯誤。這裏的mysql日誌:

34 Prepare SELECT t0.username AS username1, t0.username_canonical AS username_canonical2, t0.email AS email3, t0.email_canonical AS email_canonical4, t0.enabled AS enabled5, t0.salt AS salt6, t0.password AS password7, t0.last_login AS last_login8, t0.locked AS locked9, t0.expired AS expired10, t0.expires_at AS expires_at11, t0.confirmation_token AS confirmation_token12, t0.password_requested_at AS password_requested_at13, t0.roles AS roles14, t0.credentials_expired AS credentials_expired15, t0.credentials_expire_at AS credentials_expire_at16, t0.id AS id17, t0.firstname AS firstname18, t0.lastname AS lastname19, t0.facebookID AS facebookID20, t0.date_of_birth AS date_of_birth21, t0.locale AS locale22, t0.gender AS gender23, t0.has_profile_pic AS has_profile_pic24, t0.created_at AS created_at25, t0.updated_at AS updated_at26 FROM user t0 WHERE t0.facebookID = ? 

34 Execute SELECT t0.username AS username1, t0.username_canonical AS username_canonical2, t0.email AS email3, t0.email_canonical AS email_canonical4, t0.enabled AS enabled5, t0.salt AS salt6, t0.password AS password7, t0.last_login AS last_login8, t0.locked AS locked9, t0.expired AS expired10, t0.expires_at AS expires_at11, t0.confirmation_token AS confirmation_token12, t0.password_requested_at AS password_requested_at13, t0.roles AS roles14, t0.credentials_expired AS credentials_expired15, t0.credentials_expire_at AS credentials_expire_at16, t0.id AS id17, t0.firstname AS firstname18, t0.lastname AS lastname19, t0.facebookID AS facebookID20, t0.date_of_birth AS date_of_birth21, t0.locale AS locale22, t0.gender AS gender23, t0.has_profile_pic AS has_profile_pic24, t0.created_at AS created_at25, t0.updated_at AS updated_at26 FROM user t0 WHERE t0.facebookID = '1234' 
34 Close stmt 

34 Query START TRANSACTION 
34 Prepare INSERT INTO user (username, username_canonical, email, email_canonical, enabled, salt, password, last_login, locked, expired, expires_at, confirmation_token, password_requested_at, roles, credentials_expired, credentials_expire_at, firstname, lastname, facebookID, date_of_birth, locale, gender, has_profile_pic, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 
34 Close stmt 
34 Query COMMIT 
34 Quit 

任何線索?

更新2:

我已經登錄的PDO語句執行的一些返回值倒在教義lib和事實證明,我在我的dev得到正常的返回值(1)環境。但是,我在我的生產環境中獲得返回值。看起來像另一個提示,但我不知道該怎麼做。

順便說PDOStatement::errorCode返回00000(表明一切正常)

+0

你檢查Symfony日誌嗎? – drupality 2012-07-05 18:22:57

+0

是的,上面的插入語句來自symfony日誌。找不到其他有趣的東西。 – 2012-07-05 18:26:12

+0

這個查詢之後是否有可能發生錯誤,導致事務被恢復?檢查mysql查詢日誌 – arnaud576875 2012-07-05 18:45:19

回答

1

有可能是在對生產設置上PDO_MYSQL連接問題。檢查一次。 根據comment給出答案。

+0

但是symfony在這種情況下不應該拋出異常? – Federkun 2012-07-12 18:12:48

+0

@Laxus symfony不會在生產中拋出異常 – JamesHalsall 2012-07-13 07:50:20

+0

不是真的賺到錢,而是因爲rcarver沒有迴應,我會獎勵你賞金:) – 2012-07-15 16:50:35