2012-05-23 18:34:41 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of the Symfony package.
|
|
|
|
*
|
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Symfony\Component\Form;
|
|
|
|
|
|
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
|
|
|
*/
|
2012-07-28 09:59:23 +01:00
|
|
|
interface FormConfigBuilderInterface extends FormConfigInterface
|
2012-05-23 18:34:41 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Adds an event listener to an event on this form.
|
|
|
|
*
|
|
|
|
* @param string $eventName The name of the event to listen to.
|
|
|
|
* @param callable $listener The listener to execute.
|
|
|
|
* @param integer $priority The priority of the listener. Listeners
|
|
|
|
* with a higher priority are called before
|
|
|
|
* listeners with a lower priority.
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function addEventListener($eventName, $listener, $priority = 0);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds an event subscriber for events on this form.
|
|
|
|
*
|
|
|
|
* @param EventSubscriberInterface $subscriber The subscriber to attach.
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function addEventSubscriber(EventSubscriberInterface $subscriber);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a validator to the form.
|
|
|
|
*
|
|
|
|
* @param FormValidatorInterface $validator The validator.
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*
|
|
|
|
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function addValidator(FormValidatorInterface $validator);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
2012-06-09 13:22:15 +01:00
|
|
|
* Appends / prepends a transformer to the view transformer chain.
|
2012-05-27 20:41:59 +01:00
|
|
|
*
|
|
|
|
* The transform method of the transformer is used to convert data from the
|
|
|
|
* normalized to the view format.
|
|
|
|
* The reverseTransform method of the transformer is used to convert from the
|
|
|
|
* view to the normalized format.
|
2012-05-23 18:34:41 +01:00
|
|
|
*
|
2012-05-23 19:21:34 +01:00
|
|
|
* @param DataTransformerInterface $viewTransformer
|
2012-06-09 13:22:15 +01:00
|
|
|
* @param Boolean $forcePrepend if set to true, prepend instead of appending
|
2012-05-23 18:34:41 +01:00
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function addViewTransformer(DataTransformerInterface $viewTransformer, $forcePrepend = false);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
2012-05-27 20:41:59 +01:00
|
|
|
* Clears the view transformers.
|
2012-05-23 18:34:41 +01:00
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function resetViewTransformers();
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
2012-06-09 13:22:15 +01:00
|
|
|
* Prepends / appends a transformer to the normalization transformer chain.
|
2012-05-27 20:41:59 +01:00
|
|
|
*
|
|
|
|
* The transform method of the transformer is used to convert data from the
|
|
|
|
* model to the normalized format.
|
|
|
|
* The reverseTransform method of the transformer is used to convert from the
|
|
|
|
* normalized to the model format.
|
2012-05-23 18:34:41 +01:00
|
|
|
*
|
2012-05-23 19:21:34 +01:00
|
|
|
* @param DataTransformerInterface $modelTransformer
|
2012-06-09 13:22:15 +01:00
|
|
|
* @param Boolean $forceAppend if set to true, append instead of prepending
|
2012-05-23 18:34:41 +01:00
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function addModelTransformer(DataTransformerInterface $modelTransformer, $forceAppend = false);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears the normalization transformers.
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function resetModelTransformers();
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the value for an attribute.
|
|
|
|
*
|
|
|
|
* @param string $name The name of the attribute
|
|
|
|
* @param string $value The value of the attribute
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function setAttribute($name, $value);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the attributes.
|
|
|
|
*
|
|
|
|
* @param array $attributes The attributes.
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function setAttributes(array $attributes);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the data mapper used by the form.
|
|
|
|
*
|
|
|
|
* @param DataMapperInterface $dataMapper
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function setDataMapper(DataMapperInterface $dataMapper = null);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set whether the form is disabled.
|
|
|
|
*
|
|
|
|
* @param Boolean $disabled Whether the form is disabled
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function setDisabled($disabled);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the data used for the client data when no value is bound.
|
|
|
|
*
|
|
|
|
* @param mixed $emptyData The empty data.
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function setEmptyData($emptyData);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether errors bubble up to the parent.
|
|
|
|
*
|
|
|
|
* @param Boolean $errorBubbling
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function setErrorBubbling($errorBubbling);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether this field is required to be filled out when bound.
|
|
|
|
*
|
|
|
|
* @param Boolean $required
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function setRequired($required);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the property path that the form should be mapped to.
|
|
|
|
*
|
|
|
|
* @param string|PropertyPath $propertyPath The property path or null if the path
|
|
|
|
* should be set automatically based on
|
|
|
|
* the form's name.
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function setPropertyPath($propertyPath);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether the form should be mapped to an element of its
|
|
|
|
* parent's data.
|
|
|
|
*
|
|
|
|
* @param Boolean $mapped Whether the form should be mapped.
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function setMapped($mapped);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether the form's data should be modified by reference.
|
|
|
|
*
|
|
|
|
* @param Boolean $byReference Whether the data should be
|
2012-05-30 17:44:03 +01:00
|
|
|
* modified by reference.
|
2012-05-23 18:34:41 +01:00
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function setByReference($byReference);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether the form should be virtual.
|
|
|
|
*
|
|
|
|
* @param Boolean $virtual Whether the form should be virtual.
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function setVirtual($virtual);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
2012-07-03 18:09:41 +01:00
|
|
|
/**
|
|
|
|
* Sets whether the form should be compound.
|
|
|
|
*
|
|
|
|
* @param Boolean $compound Whether the form should be compound.
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*
|
|
|
|
* @see FormConfigInterface::getCompound()
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function setCompound($compound);
|
2012-07-03 18:09:41 +01:00
|
|
|
|
2012-05-23 18:34:41 +01:00
|
|
|
/**
|
|
|
|
* Set the types.
|
|
|
|
*
|
2012-07-12 18:17:14 +01:00
|
|
|
* @param ResolvedFormTypeInterface $type The type of the form.
|
2012-05-23 18:34:41 +01:00
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-12 18:17:14 +01:00
|
|
|
public function setType(ResolvedFormTypeInterface $type);
|
2012-05-23 18:34:41 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the initial data of the form.
|
|
|
|
*
|
|
|
|
* @param array $data The data of the form in application format.
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
2012-07-09 13:50:58 +01:00
|
|
|
public function setData($data);
|
2012-07-09 20:04:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Locks the form's data to the data passed in the configuration.
|
|
|
|
*
|
|
|
|
* A form with locked data is restricted to the data passed in
|
|
|
|
* this configuration. The data can only be modified then by
|
|
|
|
* binding the form.
|
|
|
|
*
|
|
|
|
* @param Boolean $locked Whether to lock the default data.
|
|
|
|
*
|
|
|
|
* @return self The configuration object.
|
|
|
|
*/
|
|
|
|
public function setDataLocked($locked);
|
2012-07-28 09:59:23 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Builds and returns the form configuration.
|
|
|
|
*
|
|
|
|
* @return FormConfigInterface
|
|
|
|
*/
|
|
|
|
public function getFormConfig();
|
2012-05-23 18:34:41 +01:00
|
|
|
}
|