Keluaran Baharu kecil/bentuk: 1.7.0
class InputBasic { #[StringType] private string $string; #[BooleanType] private bool $boolean; #[IntType] private int $int; #[FloatType] private float $float; #[ArrayType(new IntType())] private array $array; #[SubFormType(InputBasic::class)] private InputBasic|null $subObject = null; }
$dto = new \Small\Forms\Test\Fixture\InputObject\InputBasic(); $dto->setArray([2, 3]); $dto->setSubObject( (new \Small\Forms\Test\Fixture\InputObject\InputBasic()) ->setString('string2') ->setArray([6, 7]) ); $form = \Small\Forms\Form\FormBuilder::createFromAdapter( new \Small\Forms\Adapter\AnnotationAdapter($dto) );
git repo : https://git.small-project.dev/lib/small-forms
pembungkus : https://packagist.org/packages/small/forms
Atas ialah kandungan terperinci Bentuk Kecil .0. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!