Skip to content

Add formClass option to the SearchComponent.#354

Merged
ADmad merged 6 commits into
masterfrom
search-form
Oct 4, 2025
Merged

Add formClass option to the SearchComponent.#354
ADmad merged 6 commits into
masterfrom
search-form

Conversation

@ADmad

@ADmad ADmad commented Oct 2, 2025

Copy link
Copy Markdown
Member

This allows specifying a form class to use for the search form. It primarily helps in validating the search params before performing a redirect.

TODO: Add docs and do some in app testing.

ADmad added 5 commits October 3, 2025 00:32
This allows specifying a form class to use for the search form.
It primarily helps in validating the search params before performing a redirect.
@ADmad ADmad marked this pull request as ready for review October 3, 2025 17:16
* @return array
*/
protected function _filterParams(): array
protected function _filterParams(array $params): array

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dereuromark This is a breaking signature change but I think it's acceptable for a protected method in a new minor release.

@ADmad ADmad requested a review from Copilot October 3, 2025 17:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds form validation capabilities to the SearchComponent by introducing a new formClass configuration option. The component can now use a CakePHP Form class to validate search parameters before redirecting, providing better user experience and data validation.

  • Added formClass configuration option to SearchComponent for optional form validation
  • Modified startup flow to validate POST data against the form before redirecting
  • Added test coverage for form validation scenarios and documentation

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Controller/Component/SearchComponent.php Added formClass config, form instantiation logic, and validation flow
tests/TestCase/Controller/Component/SearchComponentTest.php Added test methods for form validation scenarios
tests/TestApp/Form/SearchForm.php Created test form class with validation rules
docs/additional-docs.md Added documentation for the new formClass feature
phpcs.xml Removed redundant installed_paths configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/Controller/Component/SearchComponent.php
@ADmad ADmad merged commit 59dfa3f into master Oct 4, 2025
7 checks passed
@ADmad ADmad deleted the search-form branch October 4, 2025 02:14
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.

3 participants