Form data to typed classes

4 months ago

dkorpar
Backer | 87
+
0
-

Are there any build in way of mapping form values to some kind of a typed entity, where we can force variable types?
Maybe some integration with https://github.com/nette/schema, would be specially interesting with php 7.4 and typed properties…

4 months ago

Mabar
Member | 259
+
+1
-

$form->setMappedType(TypedEntity::class), internally calls new TypedEntity and assigns values to public properties. Don't know about anything better and open-sourced yet.

4 months ago

dkorpar
Backer | 87
+
0
-

@Mabar thanks I know I saw that somewhere, now was checking docs but can't find anything about it… @DavidGrudl maybe updating docs with this?

4 months ago

CZechBoY
Member | 3495
+
0
-

anybody can update it via pr https://github.com/nette/docs

4 months ago

dkorpar
Backer | 87
+
+3
-

@CZechBoY if only we would know if it exists… Maybe best thing would be that person who adds some feature is required to put it to docs… PR wouldn't be merged until PR is made for docs and when merged both is merged feature and docs?