FormInterface.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. * A form group bundling multiple form forms
  13. *
  14. * @author Bernhard Schussek <bernhard.schussek@symfony.com>
  15. */
  16. interface FormInterface extends \ArrayAccess, \Traversable, \Countable
  17. {
  18. /**
  19. * Sets the parent form.
  20. *
  21. * @param FormInterface $parent The parent form
  22. */
  23. function setParent(FormInterface $parent = null);
  24. /**
  25. * Returns the parent form.
  26. *
  27. * @return FormInterface The parent form
  28. */
  29. function getParent();
  30. function getChildren();
  31. function hasChildren();
  32. function hasParent();
  33. function getErrors();
  34. function getData();
  35. function getClientData();
  36. function getRenderer();
  37. function isBound();
  38. /**
  39. * Returns the name by which the form is identified in forms.
  40. *
  41. * @return string The name of the form.
  42. */
  43. function getName();
  44. /**
  45. * Adds an error to this form
  46. *
  47. * @param FormError $error
  48. */
  49. function addError(FormError $error);
  50. /**
  51. * Returns whether the form is valid.
  52. *
  53. * @return Boolean
  54. */
  55. function isValid();
  56. /**
  57. * Returns whether the form is required to be filled out.
  58. *
  59. * If the form has a parent and the parent is not required, this method
  60. * will always return false. Otherwise the value set with setRequired()
  61. * is returned.
  62. *
  63. * @return Boolean
  64. */
  65. function isRequired();
  66. /**
  67. * Returns whether this form can be read only
  68. *
  69. * The content of a read-only form is displayed, but not allowed to be
  70. * modified. The validation of modified read-only forms should fail.
  71. *
  72. * Fields whose parents are read-only are considered read-only regardless of
  73. * their own state.
  74. *
  75. * @return Boolean
  76. */
  77. function isReadOnly();
  78. /**
  79. * Returns whether the form is empty
  80. *
  81. * @return boolean
  82. */
  83. function isEmpty();
  84. /**
  85. * Writes posted data into the form
  86. *
  87. * @param mixed $data The data from the POST request
  88. */
  89. function bind($data);
  90. function hasAttribute($name);
  91. function getAttribute($name);
  92. }