From ca6a8cf35cdfabff814a9c9d44bf58c627c5cb2b Mon Sep 17 00:00:00 2001 From: Cyperghost Date: Wed, 9 Oct 2024 15:23:52 +0200 Subject: [PATCH] Manual setting of the `objectID` in the `context` is no longer necessary. --- docs/migration/wsc60/php.md | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/docs/migration/wsc60/php.md b/docs/migration/wsc60/php.md index dfb4748d..6a6dbf26 100644 --- a/docs/migration/wsc60/php.md +++ b/docs/migration/wsc60/php.md @@ -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; -- 2.20.1