{"record":{"id":"0786fa698638607b","repo":"doctrine/orm","slug":"missing-arguments-owner-class-association","errorCode":null,"errorMessage":"Missing arguments \"--owner-class\" \"--association\"","messagePattern":"Missing arguments \"--owner-class\" \"--association\"","errorType":"console","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Tools/Console/Command/ClearCache/CollectionRegionCommand.php","lineNumber":74,"sourceCode":"EOT);\n    }\n\n    protected function execute(InputInterface $input, OutputInterface $output): int\n    {\n        $ui = (new SymfonyStyle($input, $output))->getErrorStyle();\n\n        $em         = $this->getEntityManager($input);\n        $ownerClass = $input->getArgument('owner-class');\n        $assoc      = $input->getArgument('association');\n        $ownerId    = $input->getArgument('owner-id');\n        $cache      = $em->getCache();\n\n        if (! $cache instanceof Cache) {\n            throw new InvalidArgumentException('No second-level cache is configured on the given EntityManager.');\n        }\n\n        if (( ! $ownerClass || ! $assoc) && ! $input->getOption('all')) {\n            throw new InvalidArgumentException('Missing arguments \"--owner-class\" \"--association\"');\n        }\n\n        if ($input->getOption('flush')) {\n            $cache->getCollectionCacheRegion($ownerClass, $assoc)\n                ->evictAll();\n\n            $ui->comment(\n                sprintf(\n                    'Flushing cache provider configured for <info>\"%s#%s\"</info>',\n                    $ownerClass,\n                    $assoc,\n                ),\n            );\n\n            return 0;\n        }\n\n        if ($input->getOption('all')) {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/doctrine/orm/blob/d9b9ff73016bf598ae07515f97289ce8074e97a5/src/Tools/Console/Command/ClearCache/CollectionRegionCommand.php#L56-L92","documentation":"orm:clear-cache:region:collection needs to know which collection region to evict: the owner entity class and the association name (an optional owner-id narrows it to one entry). Unless --all is passed, the command throws InvalidArgumentException('Missing arguments ...') as soon as either the owner-class or the association argument is absent.","triggerScenarios":"Running the command with only the entity class, only the association, or nothing at all, without --all: php bin/console orm:clear-cache:region:collection 'App\\Entity\\User'.","commonSituations":"Adapted shell snippets that lost an argument; scripts assuming the command clears everything by default; automation copied between projects with different arguments.","solutions":["Pass both arguments: orm:clear-cache:region:collection 'App\\Entity\\User' 'addresses' (optionally the owner id as third argument).","To evict all collection regions, pass --all.","Run --help once and copy the exact usage line into your script."],"exampleFix":"# before\n$ php bin/console doctrine:orm:clear-cache:region:collection \"App\\Entity\\User\"\n# InvalidArgumentException: Missing arguments \"--owner-class\" \"--association\"\n\n# after\n$ php bin/console doctrine:orm:clear-cache:region:collection \"App\\Entity\\User\" \"addresses\"\n# or evict every collection region:\n$ php bin/console doctrine:orm:clear-cache:region:collection --all","handlingStrategy":"validation","validationCode":"// before invoking the command programmatically or from scripts\n$ownerClass  = 'App\\Entity\\User';\n$association = 'addresses';\nif (($ownerClass === null || $association === null) && ! $all) {\n    throw new LogicException('Provide owner-class AND association, or pass --all.');\n}","typeGuard":null,"tryCatchPattern":"Catch \\InvalidArgumentException around the command execution in deploy tooling and surface it as a usage error, printing the command's --help text.","preventionTips":["Pin exact invocations in deploy scripts and test them in CI against an SLCache-enabled environment.","Use --all only when full eviction is intended: it evicts every collection region."],"tags":["doctrine-orm","console","second-level-cache","cli","cache"],"backgroundTag":"missing-required-argument","analyzedSha":"d9b9ff73016bf598ae07515f97289ce8074e97a5","analyzedAt":"2026-08-21T06:13:15.863Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}