Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andersundsehr/extbase_enum_converter
https://github.com/andersundsehr/extbase_enum_converter
hacktoberfest
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/andersundsehr/extbase_enum_converter
- Owner: andersundsehr
- License: gpl-3.0
- Created: 2022-08-19T07:30:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-24T19:43:39.000Z (almost 2 years ago)
- Last Synced: 2024-04-21T05:11:31.983Z (8 months ago)
- Topics: hacktoberfest
- Language: PHP
- Size: 23.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EXT:extbase_enum_converter
Adds the EnumConverter into TYPO3 11.
- https://forge.typo3.org/issues/98171
- https://review.typo3.org/c/Packages/TYPO3.CMS/+/75512> [FEATURE] Add TypeConverter for enums
>
> With PHP 8.1 we got Enums, to use them also in our extbase actions,
> a new TypeConverter is added with this patch.
>
> The EnumConverter is automatically used if the target type is an enum.## Install
`composer req andersundsehr/extbase_enum_converter`
## Description
With PHP 8.1 we got Enums to use them also in our extbase actions,
a new TypeConverter was added with this feature. `\TYPO3\CMS\Extbase\Property\TypeConverter\EnumConverter`## Example
Given an enum like this one:
````
enum ClosedStates
{
case hide;
case show;
case all;
}
````We can now use it like this in any extbase action:
````
public function overviewAction(ClosedStates $closed = ClosedStates::hide): ResponseInterface
{
````The URL argument can be send as `[closed]=show` and is automatically converted to an instance of `ClosedStates::show`
Impact
======Enums can now be used as extbase action arguments.
# with ♥️ from anders und sehr GmbH
> If something did not work 😮
> or you appreciate this Extension 🥰 let us know.> We are hiring https://www.andersundsehr.com/karriere/