/** * 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()); }
/** * 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()); }