Manual setting of the `objectID` in the `context` is no longer necessary.
authorCyperghost <olaf_schmitz_1@t-online.de>
Wed, 9 Oct 2024 13:23:52 +0000 (15:23 +0200)
committerCyperghost <olaf_schmitz_1@t-online.de>
Wed, 9 Oct 2024 13:23:52 +0000 (15:23 +0200)
docs/migration/wsc60/php.md

index dfb4748dd535b14df40ff50ad1b93726cd564c1f..6a6dbf26f7fbf0f472d7158a9bcaaf7dcf1d997e 100644 (file)
@@ -233,34 +233,24 @@ final class FooAddForm extends AbstractFormBuilderForm
                     FileProcessorFormField::create('imageID')
                         ->singleFileUpload()
                         ->required()
-                        ->context($this->getContent())
                         ->objectType('foo.bar.image')
                 ]),
         ]);
     }
-
-    protected function getContent(): array
-    {
-        if ($this->formObject !== null) {
-            return [
-                'fooID' => $this->formObject->fooID,
-            ];
-        }
-
-        return [];
-    }
 }
 ```
 
 #### Example for implementing an `IFileProcessor`
 
+The `objectID` in the `$context` comes from the form and corresponds to the objectID of the `FooAddForm::$formObject`.
+
 ```PHP
 final class FooImageFileProcessor extends AbstractFileProcessor
 {    
     #[\Override]
     public function acceptUpload(string $filename, int $fileSize, array $context): FileProcessorPreflightResult
     {
-        if (isset($context['fooID'])) {
+        if (isset($context['objectID'])) {
             $foo = $this->getFoo($context);
             if ($foo === null) {
                 return FileProcessorPreflightResult::InvalidContext;