Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mick3diy/form-tests-with-collectiontype
A simple Symfony project to test a User form with multiples roles
https://github.com/mick3diy/form-tests-with-collectiontype
form php symfony
Last synced: 9 days ago
JSON representation
A simple Symfony project to test a User form with multiples roles
- Host: GitHub
- URL: https://github.com/mick3diy/form-tests-with-collectiontype
- Owner: Mick3DIY
- License: mit
- Created: 2022-04-19T08:06:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-04T09:04:26.000Z (over 2 years ago)
- Last Synced: 2023-10-10T11:24:03.895Z (about 1 year ago)
- Topics: form, php, symfony
- Language: PHP
- Homepage:
- Size: 72.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Symfony form tests with CollectionType, ChoiceType (for User roles)
---------
Required :- Composer 2.2.x
- php 8.x
- Symfony 5.4.x
- SQLite (for User fixture)- User Entity (src/Entity/User.php) :
- id, username, roles, password, email
- user roles : ROLE_USER, ROLE_ADMIN_APP, ROLE_ADMIN_PROJECT, ROLE_ADMIN- User fixture (src/DataFixtures/UserFixtures.php) :
- bin/console doctrine:fixture:load- Form class (src/Form/UserType.php) :
- roles with CollectionType and ChoiceType classes **with double choices : BUG !?**- Unique controller (src/Controller/DefaultController.php) :
- actions :
- index '/'
- new user '/new'
- edit user '/edit/{id}'- Templates :
- index (templates/default/index.html.twig) with a unique form (templates/default/form.html.twig)To run this project :
```
composer install
bin/console doctrine:migration:migrate
bin/console doctrine:fixture:loadphp -S localhost:8000 -t public
```Sources :
Security : https://symfony.com/doc/current/security.html
Form : https://symfony.com/doc/current/forms.html
CollectionType field : https://symfony.com/doc/current/reference/forms/types/collection.html
ChoiceType field : https://symfony.com/doc/current/reference/forms/types/choice.html
The Difference between Data Transformers and Mappers : https://symfony.com/doc/current/form/data_mappers.html#the-difference-between-data-transformers-and-mappers
- Security : https://symfony.com/doc/current/security.html
- Form : https://symfony.com/doc/current/forms.html
- CollectionType field : https://symfony.com/doc/current/reference/forms/types/collection.html
- ChoiceType field : https://symfony.com/doc/current/reference/forms/types/choice.html
- The Difference between Data Transformers and Mappers : https://symfony.com/doc/current/form/data_mappers.html#the-difference-between-data-transformers-and-mappers