/** * {@inheritDoc} */ protected function configure() { $this->addOption('input_timezone', date_default_timezone_get()); $this->addOption('output_timezone', date_default_timezone_get()); $this->addOption('format', 'Y-m-d H:i:s'); parent::configure(); }
/** * {@inheritDoc} */ protected function configure() { $this->addOption('input_timezone', 'UTC'); $this->addOption('output_timezone', 'UTC'); $this->addOption('format', 'Y-m-d H:i:s'); parent::configure(); }
public function __construct($key = null, array $options = array()) { $this->addOption('data'); $this->addOption('trim', true); $this->addOption('required', true); $this->addOption('disabled', false); $this->addOption('property_path', (string) $key); $this->addOption('value_transformer'); $this->addOption('normalization_transformer'); $this->key = (string) $key; if (isset($options['data'])) { // Populate the field with fixed data // Set the property path to NULL so that the data is not // overwritten by the form's data $this->setData($options['data']); $this->setPropertyPath(null); } parent::__construct($options); if ($this->getOption('value_transformer')) { $this->setValueTransformer($this->getOption('value_transformer')); } if ($this->getOption('normalization_transformer')) { $this->setNormalizationTransformer($this->getOption('normalization_transformer')); } $this->normalizedData = $this->normalize($this->data); $this->transformedData = $this->transform($this->normalizedData); if (!$this->getOption('data')) { $this->setPropertyPath($this->getOption('property_path')); } }
/** * {@inheritDoc} */ protected function configure() { $this->addOption('precision', null); $this->addOption('grouping', false); $this->addOption('rounding-mode', self::ROUND_HALFUP); parent::configure(); }
public function __construct($key, array $options = array()) { $this->addOption('trim', true); $this->addOption('required', true); $this->addOption('disabled', false); $this->addOption('property_path', (string)$key); $this->addOption('value_transformer'); $this->addOption('normalization_transformer'); $this->key = (string)$key; if ($this->locale === null) { $this->locale = class_exists('\Locale', false) ? \Locale::getDefault() : 'en'; } parent::__construct($options); if ($this->getOption('value_transformer')) { $this->setValueTransformer($this->getOption('value_transformer')); } if ($this->getOption('normalization_transformer')) { $this->setNormalizationTransformer($this->getOption('normalization_transformer')); } $this->normalizedData = $this->normalize($this->data); $this->transformedData = $this->transform($this->normalizedData); $this->required = $this->getOption('required'); $this->setPropertyPath($this->getOption('property_path')); }
/** * {@inheritDoc} */ protected function configure() { $this->addOption('type', self::FRACTIONAL); $this->addOption('precision', 0); if (!in_array($this->getOption('type'), self::$types, true)) { throw new \InvalidArgumentException(sprintf('The option "type" is expected to be one of "%s"', implode('", "', self::$types))); } parent::configure(); }
protected function configure() { $this->addOption('trim', true); $this->addOption('separator', ','); $this->addOption('explode_callback', 'explode'); $this->addOption('implode_callback', 'implode'); $this->addOption('create_instance_callback', null); $this->addRequiredOption('em'); $this->addRequiredOption('class_name'); $this->addRequiredOption('field_name'); parent::configure(); }
public function __construct($key, array $options = array()) { $this->addOption('trim', true); $this->addOption('required', true); $this->addOption('disabled', false); $this->addOption('property_path', (string) $key); $this->key = (string) $key; $this->generator = new HtmlGenerator(); if ($this->locale === null) { $this->locale = class_exists('\\Locale', false) ? \Locale::getDefault() : 'en'; } parent::__construct($options); $this->transformedData = $this->transform($this->data); $this->required = $this->getOption('required'); $this->setPropertyPath($this->getOption('property_path')); }
public function __construct($key, array $options = array()) { $this->addOption('trim', true); $this->addOption('required', true); $this->addOption('disabled', false); $this->addOption('property_path', (string) $key); $this->addOption('value_transformer'); $this->addOption('normalization_transformer'); $this->key = (string) $key; $this->locale = FormConfiguration::getDefaultLocale(); parent::__construct($options); if ($this->getOption('value_transformer')) { $this->setValueTransformer($this->getOption('value_transformer')); } if ($this->getOption('normalization_transformer')) { $this->setNormalizationTransformer($this->getOption('normalization_transformer')); } $this->normalizedData = $this->normalize($this->data); $this->transformedData = $this->transform($this->normalizedData); $this->required = $this->getOption('required'); $this->setPropertyPath($this->getOption('property_path')); }
/** * Constructor. * * @param array $options An array of options * * @throws \InvalidArgumentException when a option is not supported * @throws \RuntimeException when a required option is not given */ public function __construct(array $options = array()) { $this->locale = class_exists('\\Locale', false) ? \Locale::getDefault() : 'en'; parent::__construct($options); }