DataMapperInterface.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 DataMapperInterface
  15. {
  16. /**
  17. * Maps properties of some data to a list of forms.
  18. *
  19. * @param mixed $data Structured data
  20. * @param FormInterface[]|\Traversable $forms A list of {@link FormInterface} instances
  21. *
  22. * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported
  23. */
  24. public function mapDataToForms($data, $forms);
  25. /**
  26. * Maps the data of a list of forms into the properties of some data.
  27. *
  28. * @param FormInterface[]|\Traversable $forms A list of {@link FormInterface} instances
  29. * @param mixed $data Structured data
  30. *
  31. * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported
  32. */
  33. public function mapFormsToData($forms, &$data);
  34. }