{"record":{"id":"82f9dab6908ed225","repo":"symfony/symfony","slug":"you-cannot-use-the-symfony-bridge-doctrine-form-d","errorCode":null,"errorMessage":"You cannot use the \"Symfony\\Bridge\\Doctrine\\Form\\DoctrineOrmTypeGuesser\" class as the \"symfony/form\" package is not installed. Try running \"composer require symfony/form\".","messagePattern":"You cannot use the \"Symfony\\\\Bridge\\\\Doctrine\\\\Form\\\\DoctrineOrmTypeGuesser\" class as the \"symfony/form\" package is not installed\\. Try running \"composer require symfony/form\"\\.","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php","lineNumber":40,"sourceCode":"use Doctrine\\Persistence\\Proxy;\nuse Symfony\\Bridge\\Doctrine\\Form\\Type\\EntityType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\CheckboxType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\CollectionType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\DateIntervalType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\DateTimeType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\DateType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\IntegerType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\NumberType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\TextareaType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\TimeType;\nuse Symfony\\Component\\Form\\FormTypeGuesserInterface;\nuse Symfony\\Component\\Form\\Guess\\Guess;\nuse Symfony\\Component\\Form\\Guess\\TypeGuess;\nuse Symfony\\Component\\Form\\Guess\\ValueGuess;\n\nif (!interface_exists(FormTypeGuesserInterface::class)) {\n    throw new \\LogicException('You cannot use the \"Symfony\\Bridge\\Doctrine\\Form\\DoctrineOrmTypeGuesser\" class as the \"symfony/form\" package is not installed. Try running \"composer require symfony/form\".');\n}\n\nclass DoctrineOrmTypeGuesser implements FormTypeGuesserInterface\n{\n    private array $cache = [];\n\n    public function __construct(\n        protected ManagerRegistry $registry,\n    ) {\n    }\n\n    public function guessType(string $class, string $property): ?TypeGuess\n    {\n        if (!$ret = $this->getMetadata($class)) {\n            return new TypeGuess(TextType::class, [], Guess::LOW_CONFIDENCE);\n        }\n\n        [$metadata, $name] = $ret;","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/symfony/symfony/blob/698e28026c22cf35d032cdb6e800db48b1535790/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php#L22-L58","documentation":"Thrown at class-load time when DoctrineOrmTypeGuesser.php is autoloaded but the symfony/form package (FormTypeGuesserInterface) is not installed (DoctrineOrmTypeGuesser.php:39-41). The guesser implements FormTypeGuesserInterface, so without the Form component the class cannot exist; Symfony fails fast with an actionable message.","triggerScenarios":"Autoloading Symfony\\Bridge\\Doctrine\\Form\\DoctrineOrmTypeGuesser (e.g. it is referenced in service configuration, a bundle autoconfig, or code) while symfony/form is not in composer.json. The `if (!interface_exists(FormTypeGuesserInterface::class))` guard fires at file load.","commonSituations":"Installing symfony/doctrine-bridge without symfony/form; an API-only skeleton that dropped form but left the guesser wired in services.yaml; DoctrineBundle default config referencing the guesser.","solutions":["Install the Form component: 'composer require symfony/form'.","If you intentionally do not use forms, remove the DoctrineOrmTypeGuesser service/tag from your config and any code referencing it.","Clear the cache after changing dependencies so stale container refs don't autoload the class."],"exampleFix":"# before: symfony/form absent, services.yaml references doctrine.orm_type_guesser\ncomposer show symfony/form   # not installed -> LogicException on boot\n\n# after\ncomposer require symfony/form\n# or, if forms are unused, remove the DoctrineOrmTypeGuesser service from config","handlingStrategy":"validation","validationCode":"use Symfony\\Component\\Form\\FormTypeGuesserInterface;\nif (!interface_exists(FormTypeGuesserInterface::class)) {\n    throw new \\LogicException('symfony/form missing — cannot use DoctrineOrmTypeGuesser');\n}","typeGuard":"function formComponentInstalled(): bool {\n    return interface_exists(\\Symfony\\Component\\Form\\FormTypeGuesserInterface::class);\n}","tryCatchPattern":"// Avoid referencing the class when the component is absent\nif (class_exists(\\Symfony\\Bridge\\Doctrine\\Form\\DoctrineOrmTypeGuesser::class, false)) { /* safe */ }","preventionTips":["Keep symfony/* bundles version-aligned in composer.json.","CI: assert interface_exists(FormTypeGuesserInterface) when doctrine-bridge form guesser is wired.","Remove unused guesser service tags if you drop symfony/form."],"tags":["doctrine","form","missing-dependency","configuration"],"analyzedSha":"698e28026c22cf35d032cdb6e800db48b1535790","analyzedAt":"2026-08-06T23:40:49.025Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}