簡體   English   中英

獨立項目中的Symfony 2.8驗證程序組件

[英]Symfony 2.8 Validator Component in a standalone project

我試圖在我們的小型應用程序中包括Symfony Validator組件。 但是我無法正常工作。 我想我把所有東西都放在一起了,但是我總是得到一個例外。

AnnotationException in AnnotationException.php line 54:
[Semantical Error] The annotation "@Symfony\Component\Validator\Constraints\NotBlank" in property UserEntity ::$username does not exist, or could not be auto-loaded.

但是該類存在並自動加載。 我用: AnnotationRegistry::registerLoader()測試了它。

您可以在這里找到我正在使用的代碼: https : //gist.github.com/anonymous/c44fc5a1068b13e9ca22

這是因為AnnotationRegistry如何通過名稱空間加載類。

AnnotationRegistry嘗試加載.../vendor/symfony/validator/Constraints/Symfony/Component/Validator/Constraints/NotBlank.php ,而不是.../vendor/symfony/validator/Constraints/NotBlank.php 更多信息

使用AnnotationRegistry::registerLoader()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM