Skip to content

Add FileType tests, fix Symfony 8 options, replace entityClass with entity in events#2

Merged
wtorsi merged 4 commits intomainfrom
8.0
Feb 20, 2026
Merged

Add FileType tests, fix Symfony 8 options, replace entityClass with entity in events#2
wtorsi merged 4 commits intomainfrom
8.0

Conversation

@wtorsi
Copy link
Contributor

@wtorsi wtorsi commented Feb 20, 2026

Summary

  • FileType integration tests: 17 tests covering single-file submit, original file preservation, delete checkbox, collection scenarios, view variables, options validation, and memory cleanup
  • Fix FileType nested options: Migrate delete_options and entry_options from inline closures in setDefaults() to Symfony 8's setOptions() API — the old API no longer auto-detects OptionsResolver-parameter closures as nested options
  • Replace $entityClass with $entity in all events: All events (PreUploadEvent, PostUploadEvent, PreRemoveEvent, PostRemoveEvent) now carry the entity object instead of the class name string, enabling instanceof checks instead of string comparison

Test plan

  • composer run-script test — 131 tests, 306 assertions, all pass
  • composer run-script analyse — PHPStan level max, no errors
  • composer run-script cs-check — no CS violations

🤖 Generated with Claude Code

Dev and others added 4 commits February 20, 2026 00:15
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds Symfony Form integration with a compound FileType that preserves
the original Model\File across submissions, supports MIME type validation,
multiple uploads, and an optional delete checkbox.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…on validation

- Fix PRE_SUBMIT not restoring original files in multiple mode (empty
  array is not null, so ??= never triggered)
- Add explicit priorities to POST_SET_DATA listeners to guarantee
  data capture runs before delete checkbox is added
- Skip empty File constraint when mime_types is not configured
- Add normalizer to throw LogicException when allow_delete conflicts
  with required option instead of silently ignoring

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lace $entityClass with $entity in events

- Add 17 integration tests for FileType covering single file, collection, delete, view vars, and cleanup
- Fix FileType nested options (delete_options, entry_options) to use Symfony 8 setOptions() API
- Replace $entityClass (string) with $entity (object) across all events and Handler::remove()
- Update README and CLAUDE.md to reflect the event API changes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wtorsi wtorsi changed the title 8.0 Add FileType tests, fix Symfony 8 options, replace entityClass with entity in events Feb 20, 2026
@wtorsi wtorsi merged commit c64f521 into main Feb 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant