Skip to content

Commit ca6a8cf

Browse files
committed
Manual setting of the objectID in the context is no longer necessary.
1 parent d3cf3d5 commit ca6a8cf

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

docs/migration/wsc60/php.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -233,34 +233,24 @@ final class FooAddForm extends AbstractFormBuilderForm
233233
FileProcessorFormField::create('imageID')
234234
->singleFileUpload()
235235
->required()
236-
->context($this->getContent())
237236
->objectType('foo.bar.image')
238237
]),
239238
]);
240239
}
241-
242-
protected function getContent(): array
243-
{
244-
if ($this->formObject !== null) {
245-
return [
246-
'fooID' => $this->formObject->fooID,
247-
];
248-
}
249-
250-
return [];
251-
}
252240
}
253241
```
254242

255243
#### Example for implementing an `IFileProcessor`
256244

245+
The `objectID` in the `$context` comes from the form and corresponds to the objectID of the `FooAddForm::$formObject`.
246+
257247
```PHP
258248
final class FooImageFileProcessor extends AbstractFileProcessor
259249
{
260250
#[\Override]
261251
public function acceptUpload(string $filename, int $fileSize, array $context): FileProcessorPreflightResult
262252
{
263-
if (isset($context['fooID'])) {
253+
if (isset($context['objectID'])) {
264254
$foo = $this->getFoo($context);
265255
if ($foo === null) {
266256
return FileProcessorPreflightResult::InvalidContext;

0 commit comments

Comments
 (0)