FormBuilderInterface.php 2.1 KB

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