FormContractorInterface.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /*
  3. * This file is part of the Sonata Project package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  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 Sonata\AdminBundle\Builder;
  11. use Sonata\AdminBundle\Admin\FieldDescriptionInterface;
  12. use Symfony\Component\Form\FormBuilder;
  13. use Symfony\Component\Form\FormFactoryInterface;
  14. /**
  15. * This interface should be implemented in persistence bundles.
  16. *
  17. * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
  18. */
  19. interface FormContractorInterface extends BuilderInterface
  20. {
  21. /**
  22. * @abstract
  23. *
  24. * @param FormFactoryInterface $formFactory
  25. */
  26. public function __construct(FormFactoryInterface $formFactory);
  27. /**
  28. * @abstract
  29. *
  30. * @param string $name
  31. * @param array $options
  32. *
  33. * @return FormBuilder
  34. */
  35. public function getFormBuilder($name, array $options = array());
  36. /**
  37. * Should provide Symfony form options.
  38. *
  39. * @abstract
  40. *
  41. * @param string $type
  42. * @param FieldDescriptionInterface $fieldDescription
  43. *
  44. * @return array
  45. */
  46. public function getDefaultOptions($type, FieldDescriptionInterface $fieldDescription);
  47. }