/** * @return Form */ protected function getForm() { if (!isset($this->form)) { $this->form = Form::fromArray($this->getFields()); } return $this->form; }
protected function setUp() { $this->fields = ['test_field' => new Field('Test field', ['optionName' => 'test', 'validator' => function ($value) { return $value === $this->validString; }]), 'email' => new EmailAddressField('Email address', ['optionName' => 'mail']), 'to_upper' => new Field('Normalized field', ['optionName' => 'to-upper', 'description' => 'Input will be changed to upper case', 'normalizer' => 'strtoupper', 'required' => false]), 'bool' => new BooleanField('Boolean field', ['optionName' => 'bool', 'required' => false]), 'array' => new ArrayField('Array field', ['optionName' => 'array', 'required' => false])]; $this->form = Form::fromArray($this->fields); $this->validResult = ['test_field' => $this->validString, 'email' => $this->validMail, 'to_upper' => null, 'bool' => true, 'array' => []]; }
protected function setUp() { $this->fields = ['test_field' => new Field('Test field', ['optionName' => 'test', 'validator' => function ($value) { return $value === $this->validString; }]), 'email' => new EmailAddressField('Email address', ['optionName' => 'mail']), 'with_default' => new Field('Field with default', ['default' => 'defaultValue']), 'bool' => new BooleanField('Boolean field', ['optionName' => 'bool', 'required' => false]), 'array' => new ArrayField('Array field', ['optionName' => 'array', 'required' => false])]; $this->form = Form::fromArray($this->fields); $this->validResult = ['test_field' => $this->validString, 'email' => $this->validMail, 'bool' => true, 'array' => [], 'with_default' => 'defaultValue']; }
/** * {@inheritdoc} */ protected function configure() { $this->setName('project:create')->setAliases(['create'])->setDescription('Create a new project'); $this->form = Form::fromArray($this->getFields()); $this->form->configureInputDefinition($this->getDefinition()); }