-
-
Notifications
You must be signed in to change notification settings - Fork 110
/
FormBuilderInterface.php
69 lines (60 loc) · 1.86 KB
/
FormBuilderInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form;
/**
* @author Bernhard Schussek <[email protected]>
*
* @extends \Traversable<string, FormBuilderInterface>
*/
interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuilderInterface
{
/**
* Adds a new field to this group. A field must have a unique name within
* the group. Otherwise the existing field is overwritten.
*
* If you add a nested group, this group should also be represented in the
* object hierarchy.
*
* @param array<string, mixed> $options
*/
public function add(string|self $child, ?string $type = null, array $options = []): static;
/**
* Creates a form builder.
*
* @param string $name The name of the form or the name of the property
* @param string|null $type The type of the form or null if name is a property
* @param array<string, mixed> $options
*/
public function create(string $name, ?string $type = null, array $options = []): self;
/**
* Returns a child by name.
*
* @throws Exception\InvalidArgumentException if the given child does not exist
*/
public function get(string $name): self;
/**
* Removes the field with the given name.
*/
public function remove(string $name): static;
/**
* Returns whether a field with the given name exists.
*/
public function has(string $name): bool;
/**
* Returns the children.
*
* @return array<string, self>
*/
public function all(): array;
/**
* Creates the form.
*/
public function getForm(): FormInterface;
}