无法加载类型的“ app \ form \ repoyedtype”:class不存在

发布于 2025-01-30 02:44:45 字数 3789 浏览 1 评论 0原文

我从synfony 4升级到5。然后,我尝试测试我的注册页面并获得此信息:无法加载“ app \ form \ form \ form \ repotedtype”:class不存在。

我拥有的东西尝试:

  • 作曲家安装-NO-DEV- iptimize-autoloader(我在网上找到了这一点)

结果:

Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Package operations: 0 installs, 0 updates, 5 removals
  - Removing symfony/web-profiler-bundle (v5.4.8)
  - Removing symfony/maker-bundle (v1.42.0)
  - Removing nikic/php-parser (v4.13.2)
  - Removing doctrine/doctrine-fixtures-bundle (3.4.2)
  - Removing doctrine/data-fixtures (1.5.3)
Generating optimized autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
69 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Run composer recipes at any time to see the status of your Symfony recipes.

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
!!  Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
!!  Symfony\Component\ErrorHandler\Error\ClassNotFoundError {#83
!!    #message: """
!!      Attempted to load class "MakerBundle" from namespace "Symfony\Bundle\MakerBundle".\n
!!      Did you forget a "use" statement for another namespace?
!!      """
!!    #code: 0
!!    #file: "D:\cours\symfony\blog\vendor\symfony\framework-bundle\Kernel\MicroKernelTrait.php"     
!!    #line: 132
!!    trace: {
!!      D:\cours\symfony\blog\vendor\symfony\framework-bundle\Kernel\MicroKernelTrait.php:132 { …}   
!!      D:\cours\symfony\blog\vendor\symfony\http-kernel\Kernel.php:386 { …}
!!      D:\cours\symfony\blog\vendor\symfony\http-kernel\Kernel.php:786 { …}
!!      D:\cours\symfony\blog\vendor\symfony\http-kernel\Kernel.php:128 { …}
!!      D:\cours\symfony\blog\vendor\symfony\framework-bundle\Console\Application.php:168 { …}       
!!      D:\cours\symfony\blog\vendor\symfony\framework-bundle\Console\Application.php:74 { …}        
!!      D:\cours\symfony\blog\vendor\symfony\console\Application.php:171 { …}
!!      D:\cours\symfony\blog\vendor\symfony\runtime\Runner\Symfony\ConsoleApplicationRunner.php:54 { …}
!!      D:\cours\symfony\blog\vendor\autoload_runtime.php:35 { …}
!!      D:\cours\symfony\blog\bin\console:11 {
!!        ›
!!        › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
!!        ›
!!        arguments: {
!!          "D:\cours\symfony\blog\vendor\autoload_runtime.php"
!!        }
!!      }
!!    }
!!  }
!!  Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
!!  Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
!!  2022-05-17T00:33:06+02:00 [critical] Uncaught Error: Class 'Symfony\Bundle\MakerBundle\MakerBundle' not found
!!
Script @auto-scripts was called via post-install-cmd 

很奇怪,因为其他表格刚刚起作用(现在他们被打破了:<代码>尝试从名称空间加载“ MakerBundle” Symfony \ Bundle \ MakerBundle”

  • 。 /代码> 现在,除了注册页面(“ app \ form \ repotedtype”:class不存在。)。

值得一提的是,我的自动完成在文件夹中查找Symfony \ component \ component \ compents \ compents \ compents \ compents \ compents \ compents \ compents \ compents \ corm \ extensy \ core \ type \ type \ type \ repotedtype在文件夹中。 有时,当我清除缓存时,优化时会崩溃。

感谢您的阅读。

I upgrade from synfony 4 to 5. Then i try to test my registration page and get this: Could not load type "App\Form\RepeatedType": class does not exist.

What i have try:

  • composer install --no-dev --optimize-autoloader (i found this online)

The result:

Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Package operations: 0 installs, 0 updates, 5 removals
  - Removing symfony/web-profiler-bundle (v5.4.8)
  - Removing symfony/maker-bundle (v1.42.0)
  - Removing nikic/php-parser (v4.13.2)
  - Removing doctrine/doctrine-fixtures-bundle (3.4.2)
  - Removing doctrine/data-fixtures (1.5.3)
Generating optimized autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
69 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Run composer recipes at any time to see the status of your Symfony recipes.

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
!!  Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
!!  Symfony\Component\ErrorHandler\Error\ClassNotFoundError {#83
!!    #message: """
!!      Attempted to load class "MakerBundle" from namespace "Symfony\Bundle\MakerBundle".\n
!!      Did you forget a "use" statement for another namespace?
!!      """
!!    #code: 0
!!    #file: "D:\cours\symfony\blog\vendor\symfony\framework-bundle\Kernel\MicroKernelTrait.php"     
!!    #line: 132
!!    trace: {
!!      D:\cours\symfony\blog\vendor\symfony\framework-bundle\Kernel\MicroKernelTrait.php:132 { …}   
!!      D:\cours\symfony\blog\vendor\symfony\http-kernel\Kernel.php:386 { …}
!!      D:\cours\symfony\blog\vendor\symfony\http-kernel\Kernel.php:786 { …}
!!      D:\cours\symfony\blog\vendor\symfony\http-kernel\Kernel.php:128 { …}
!!      D:\cours\symfony\blog\vendor\symfony\framework-bundle\Console\Application.php:168 { …}       
!!      D:\cours\symfony\blog\vendor\symfony\framework-bundle\Console\Application.php:74 { …}        
!!      D:\cours\symfony\blog\vendor\symfony\console\Application.php:171 { …}
!!      D:\cours\symfony\blog\vendor\symfony\runtime\Runner\Symfony\ConsoleApplicationRunner.php:54 { …}
!!      D:\cours\symfony\blog\vendor\autoload_runtime.php:35 { …}
!!      D:\cours\symfony\blog\bin\console:11 {
!!        ›
!!        › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
!!        ›
!!        arguments: {
!!          "D:\cours\symfony\blog\vendor\autoload_runtime.php"
!!        }
!!      }
!!    }
!!  }
!!  Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
!!  Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
!!  2022-05-17T00:33:06+02:00 [critical] Uncaught Error: Class 'Symfony\Bundle\MakerBundle\MakerBundle' not found
!!
Script @auto-scripts was called via post-install-cmd 

WEIRD because others forms worked just before (and now they are broken saying: Attempted to load class "MakerBundle" from namespace "Symfony\Bundle\MakerBundle". Did you forget a "use" statement for another namespace?)

  • composer require symfony/maker-bundle --dev
    Now it's working again except for the registration page ("App\Form\RepeatedType": class does not exist.).

It's worth notting that my autocomplet find Symfony\Component\Form\Extension\Core\Type\RepeatedType in the folder.
And sometimes when i clear cache, it crash when optimizing.

Thanks for reading.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海少女心 2025-02-06 02:44:45

在Symfony 5中,重复type的使用语句为使用Symfony \ Component \ Component \ compention \ extension \ extension \ core \ type \ type \ repoteDtype;

and ,并用于假设密码fiel您将输入类似的内容:

$builder
->add('password', RepeatedType::class, [
    'type' => PasswordType::class,
    'required' => false,
    'mapped' => false,
    'first_options' => ['label' => 'New password'],
    'second_options' => ['label' => 'Repeat password'],
]);

In symfony 5 the use statement for RepeatedType is use Symfony\Component\Form\Extension\Core\Type\RepeatedType;

And to use for let's say a password fiel you would type something like:

$builder
->add('password', RepeatedType::class, [
    'type' => PasswordType::class,
    'required' => false,
    'mapped' => false,
    'first_options' => ['label' => 'New password'],
    'second_options' => ['label' => 'Repeat password'],
]);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文