예제 #1
0
 /**
  * Creates a new form based on the given configuration.
  *
  * @param FormConfigInterface $config The form configuration.
  */
 public function __construct(FormConfigInterface $config)
 {
     if (!$config instanceof UnmodifiableFormConfig) {
         $config = new UnmodifiableFormConfig($config);
     }
     $this->config = $config;
     $this->setData($config->getData());
 }
예제 #2
0
파일: Form.php 프로젝트: nathanlon/symfony
 /**
  * Creates a new form based on the given configuration.
  *
  * @param FormConfigInterface $config The form configuration.
  */
 public function __construct(FormConfigInterface $config)
 {
     if (!$config instanceof UnmodifiableFormConfig) {
         $config = new UnmodifiableFormConfig($config);
     }
     // Compound forms always need a data mapper, otherwise calls to
     // `setData` and `add` will not lead to the correct population of
     // the child forms.
     if ($config->getCompound() && !$config->getDataMapper()) {
         throw new FormException('Compound forms need a data mapper');
     }
     $this->config = $config;
     $this->setData($config->getData());
 }