[英]Custom Bundle with Symfony 6.2
我正在嘗試創建一個 Bundle 以在我的不同項目之間共享一些服務和實用程序類。 我在使用 Symfony 5.4 時已經這樣做了。 但現在我想遷移到PHP 8.1使用Symfony 6.2 。 我不知道我做錯了什么,但我的 web 項目只是看不到我在 Bundle 中創建的服務。 一步步: 我創 ...
[英]Custom Bundle with Symfony 6.2
我正在嘗試創建一個 Bundle 以在我的不同項目之間共享一些服務和實用程序類。 我在使用 Symfony 5.4 時已經這樣做了。 但現在我想遷移到PHP 8.1使用Symfony 6.2 。 我不知道我做錯了什么,但我的 web 項目只是看不到我在 Bundle 中創建的服務。 一步步: 我創 ...
[英]Api-Platform 3: DataTransformerInterface Issue
我正在學習創建 DTO 和 DataTransformerInterface 以在我的響應中發送特定數據。 問題是文件“DataTransformerInterface”丟失了。 當我檢查“Api-Platform”文件夾時,核心文件夾丟失了,當我在 git 存儲庫上驗證時,核心文件夾在那里不可用。 ...
[英]Symfony & doctrine : how limit the number of association between two entities in ManyToOne relation?
給定一個 Symfony 6 示例項目,我在其中定義了兩個實體“A”和“B”。 “A”和“B”之間定義的關系是 oneToMany(“A”可以包含“B”的 N 個實例) 我的問題:是否有一種簡單的服務器端方式來限制鏈接到“A”的“B”的數量? (例如,當用戶通過表單創建一個新的“A”時,他必須 ...
[英]Routes are declared in routes.yaml but symfony don't found them. Even when i try using annotations
我有一個 symfony 應用程序忽略了我可以聲明的 roytes。 例如,我在routes.yaml中有這行代碼:app_titi path: /titi methods: ['GET'] defaults: _controller: 'App\Contro ...
[英]"requirements could not be resolved to an installable set of packages" when I try to create a web app symfony 6 project
當我嘗試創建一個 web 應用程序 symfony 6 項目時,我收到此錯誤消息:“您的要求無法解析為一組可安裝的軟件包”並且似乎沒有安裝依賴項(我的項目中的很多文件夾都丟失了)。 MacBook-Pro-de-Ludovic:programmation lesage$ symfony new ...
[英]Find entity with relation collection all match value
在我的 Symfony 項目中,我有一個“ExerciceComptable”和一個“DocumentAttendu”實體。 ExerciceComptable 中有一個引用 DocumentAttendu (OneToMany) 的關系。 在 DocumentAttendu 中,我有一個名為“r ...
[英]Symfony 6 : how to import bundle translations?
我正在使用 Symfony 6 並且不明白我應該如何為依賴消息啟用翻譯。 例如:我剛剛安裝了 SymfonyCasts/verify-email-bundle,它在其目錄 (src/Resources/translations) 中提供翻譯為了啟用它們,我有: 安裝翻譯包: composer re ...
[英]Symfony 6: embedded form Collection with File upload in child form
我有一個實體ClientFileAction ,它是OneToMany關系中實體Attachment的父級。 Attachment不僅包含文件路徑,還包含有關文件的信息,如標題、上傳日期等。 Attachment: 在創建表單類型AttachmentType和一對一上傳文件時,沒有問題: Atta ...
[英]Symfony 6 #[Autowire] VS #[Target] attributes
從symfony docs看來,我們可以使用#[Target('service_id')]屬性來指定要注入的服務 ID。 從另一方面看,新的symfony 6 功能之一是#[Autowire(service: 'service_id')]屬性,它描述了將參數連接到什么。 乍一看, #[Target] ...
[英]Can't find the config/packages/api_platform.yaml on Symfony 6
在我的 Symfony 6.2 項目上安裝 API 平台后使用 composer 命令composer require API 我在config/packages文件夾中找不到 api_platform.yaml 文件,我找到的唯一與 API-PLATFORM 相關的文件在routes目錄中這是一 ...
[英]How to generate FormType for many-to-many relation for non-existing items in Symfony 6?
我在Article和Tag實體之間有簡單的多對多關系。 我想使用 FormType 創建一篇新文章並將標簽與其相關聯。 但情況是:我想關聯可能還不存在的標簽。 此 FormType 僅為現有標簽生成多 select 表單。 但我想要一個<textarea>字段,用戶可以在其中放置現有和 ...
[英]Symfony 6.2 and json_login not save authenticated state
我有配置(security.yaml): 在調試面板中,我看到了Authenticated並且我看到了真正的 getUserIdentifier()。 但是,如果我重新加載頁面,那么我就不會再次登錄。 如果將 json_login 移動到主塊,那么一切正常。 什么東西少了? 我嘗試了不同的自定義授 ...
[英]Symfony 6 : Login impossible (nothing happens)
我希望你能幫助我... 當我嘗試登錄我的 Symfony 6 應用程序時,沒有任何反應。 我沒有錯誤,但它不記錄我。 它只會刷新頁面。 安全.yaml 安全控制器::登錄 我的產品服務器是最新的,我可以登錄,但在開發 (127.0.0.1) 中這是不可能的。 謝謝您的幫助。 ...
[英]Symfony: The return type of method "X" in class "Y" is invalid
我最近向我的一個實體添加了一個新方法,該方法檢索相關集合。 在編譯時,我收到以下錯誤: 我的代碼如下: 這似乎是一個簡單的添加,它模仿(完全)我的代碼中的其他集合檢索方法。 那么...為什么會出錯? ...
[英]Why I have "Not found" /admin in symfony easyAdminBundle 4 (php)
在 symfony 應用程序中安裝 easyAdminBundle 后,我無法打開 /admin 頁面。 我這樣做: symfony composer req "admin:^4"然后symfony console make:admin:dashboard 此行生成此代碼。 但是當我嘗試打開 /a ...
[英]How to make left join in dql Symfony
我想了解 dql 邏輯,我想創建這種請求。 下面是我想要執行的 SQL 請求: SELECT titlemission,descriptionmission,onsetdate,deadline,budgetmission,prioritymission,company FROM mission ...
[英]API Platform - Subresources: Cannot use reference for lookup or graphLookup: dbRef references are not supported (MongoDB-Symfony6.2)
我目前正在使用 Symfony 版本 6.2 和 API 平台以及數據庫中的 MongoDB(版本 v6.0.3)編寫網站。 我嘗試使用 Subresources 並遵循 API 平台的官方文檔: https://api-platform.com/docs/core/subresources/ 我 ...
[英]How to insert into Many Many junction table
我是 symfony 的新手,我想了解如何在我的聯結表上添加數據。 我得到了任務實體和用戶實體。 單擊一個按鈕后,我想將當前的 idmission 和 iduser 添加到名為 mission_user 的聯結表中。 我能怎么做? 這是我的實體使命: <?php namespace App\ ...
[英]Unrecognized option "api_platform" under "lexik_jwt_authentication"
除了數據庫中的MongoDB和Docker上的工作環境之外,我目前正在使用Symfony 6.2版和API 平台對網站進行編程。 我正在嘗試添加通過 JWT ( LexikJWTAuthenticationBundle ) 連接的功能,並且我能夠成功登錄並獲取令牌,但是當我嘗試使用令牌訪問其余頁面 ...