我使用Symfony 3.0.9和FosUserBundle來構建我的應用程序。我最近做了一個作曲家更新,現在我無法通過UserManager或命令行創建用戶。錯誤是Integrity constraint violation: 1048 Column 'salt' cannot be null
。當我明確地調用父:: __建設()在我的構造方法,如下所示,就會出現此錯誤甚至:Symfony 3 FOSUSERBUNDLE UPDATE破壞了我的應用程序
/**
* constructor.
*/
public function __construct()
{
parent::__construct();
}
而且也將失敗,如果我叫喜歡$user->setSalt('87234hjjdwshjdsjkds')
的setSalt方法的一切努力來解決這個有失敗使我開始關注我的作曲家更新命令,這是一些輸出:
Updating dependencies (including require-dev)
Removing twig/twig (v1.24.1)
Installing twig/twig (v1.28.2)
Loading from cache
Removing symfony/polyfill-util (v1.2.0)
Installing symfony/polyfill-util (v1.3.0)
Loading from cache
...
Removing symfony/polyfill-intl-icu (v1.2.0)
Installing symfony/polyfill-intl-icu (v1.3.0)
Loading from cache
Removing psr/log (1.0.0)
Installing psr/log (1.0.2)
Loading from cache
Removing doctrine/cache (v1.6.0)
Installing doctrine/cache (v1.6.1)
Loading from cache
...
Removing doctrine/orm (v2.5.4)
Installing doctrine/orm (v2.5.5)
Loading from cache
Removing sensiolabs/security-checker (v3.0.2)
Installing sensiolabs/security-checker (v4.0.0)
Loading from cache
Removing nikic/php-parser (v2.1.0)
Installing nikic/php-parser (v2.1.1)
Loading from cache
\t ...
Removing doctrine/doctrine-migrations-bundle (1.1.1)
Installing doctrine/doctrine-migrations-bundle (v1.2.0)
Loading from cache
...
Removing phpspec/phpspec (2.5.1)
Installing phpspec/phpspec (2.5.5)
Loading from cache
Removing doctrine/data-fixtures (v1.2.1)
Installing doctrine/data-fixtures (v1.2.2)
Loading from cache
Updating friendsofsymfony/user-bundle dev-master (147ca68 => 7261f7a)
Checking out 7261f7aa143b4bfdb0b7ddc5df208067fa7be698
正如你所見,FOSUSERBUNDLE已經更新。
恢復作曲家更新,刪除我的供應商目錄並運行作曲家安裝修復它。這歸結爲更新。這是問題所在。
如果有人知道我可以如何更新並仍然有工作的應用程序,我將非常感謝您的意見和反饋。
您是否更新過模式?據我記得,以前的更新刪除了一些FOSUser實體字段,也許你試圖插入數據不再存在的領域。 –
感謝@BartBartoman,我將運行'composer update'並重試。 – mrbabson
是的!這工作!在作曲家更新之後,我更新了架構並更新了用戶表。這太棒了。謝謝 – mrbabson