/**
  * Instanciate the base filter
  *
  * @param AttributeValidatorHelper       $attrValidatorHelper
  * @param ConfigurationRegistryInterface $registry
  * @param ReferenceDataIdResolver        $idsResolver
  * @param array                          $supportedOperators
  */
 public function __construct(AttributeValidatorHelper $attrValidatorHelper, ConfigurationRegistryInterface $registry, ReferenceDataIdResolver $idsResolver, array $supportedOperators = [])
 {
     $this->attrValidatorHelper = $attrValidatorHelper;
     $this->registry = $registry;
     $this->idsResolver = $idsResolver;
     $this->supportedOperators = $supportedOperators;
     $this->optionsResolver = new OptionsResolver();
     $this->optionsResolver->setRequired(['field']);
     $this->optionsResolver->setOptional(['locale', 'scope']);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['text']);
     $resolver->setOptional(['class', 'name']);
     $resolver->setDefaults(['name' => '']);
     $resolver->setAllowedTypes(['text' => 'string', 'class' => 'string']);
 }
Example #3
0
 /**
  * Configures Form attributes
  *
  * @param OptionsResolverInterface $resolver
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['name']);
     $resolver->setOptional(['class', 'action', 'method', 'tabs', 'property_path', 'dependencies', 'property_path', 'dependencies', 'filters', 'rules']);
     $resolver->setDefaults(['action' => '', 'class' => '', 'method' => self::FORM_METHOD, 'tabs' => self::TABS_VERTICAL, 'property_path' => null, 'dependencies' => [], 'filters' => [], 'rules' => []]);
     $resolver->setAllowedTypes(['class' => 'string', 'action' => 'string', 'method' => 'string', 'tabs' => 'integer']);
 }
Example #4
0
 /**
  * @param OptionsResolverInterface $resolver
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setOptional(array('default', 'query_builder', 'choices'));
     $resolver->setAllowedTypes(array('choices' => 'array'));
     $resolver->setRequired(array('create_form_type', 'class', 'property'));
     $resolver->setDefaults(array('multiple' => false, 'to_select_text' => 'Выбрать', 'to_new_text' => 'Создать'));
 }
 /**
  * Custom options:
  * - "workflow_item" - required, instance of WorkflowItem entity
  * - "step_name"     - optional, name of step
  *
  * @param OptionsResolverInterface $resolver
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(array('workflow_item'));
     $resolver->setOptional(array('step_name'));
     $resolver->setAllowedTypes(array('step_name' => 'string'));
     $resolver->setNormalizers(array('step_name' => function (Options $options, $stepName) {
         /** @var Workflow $workflow */
         $workflow = $options['workflow'];
         /** @var WorkflowItem $workflowItem */
         $workflowItem = $options['workflow_item'];
         if (!$stepName) {
             $stepName = $workflowItem->getCurrentStepName();
         }
         if (!$workflow->getStepManager()->getStep($stepName)) {
             throw new InvalidConfigurationException(sprintf('Invalid reference to unknown step "%s" of workflow "%s".', $stepName, $workflow->getName()));
         }
         return $stepName;
     }, 'disable_attribute_fields' => function (Options $options, $disableAttributeFields) {
         /** @var Workflow $workflow */
         $workflow = $options['workflow'];
         /** @var WorkflowItem $workflowItem */
         $workflowItem = $options['workflow_item'];
         $step = $workflow->getStepManager()->getStep($options['step_name']);
         if ($step->getName() !== $workflowItem->getCurrentStepName() || $workflowItem->isClosed()) {
             $disableAttributeFields = true;
         }
         return $disableAttributeFields;
     }));
 }
Example #6
0
 /**
  * Sets the configuration for the options resolver
  * @param OptionsResolverInterface $resolver
  */
 protected function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(array('file', 'document_columns', 'category_column'));
     $resolver->setOptional(array('limit', 'delimiter', 'enclosure', 'escape', 'category_modifier'));
     $resolver->setDefaults(array('limit' => false, 'length' => 0, 'delimiter' => ',', 'enclosure' => '"', 'escape' => '\\', 'category_modifier' => false));
     $resolver->setAllowedTypes(array('file' => 'string', 'document_columns' => 'array', 'category_column' => 'string', 'length' => 'int', 'delimiter' => 'string', 'enclosure' => 'string', 'escape' => 'string'));
 }
 /**
  * {@inheritDoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $uploadConfig = array('uploadRoute' => 'comur_api_upload', 'uploadUrl' => null, 'webDir' => null, 'fileExt' => '*.jpg;*.gif;*.png;*.jpeg', 'libraryDir' => null, 'libraryRoute' => 'comur_api_image_library', 'showLibrary' => true, 'saveOriginal' => false);
     $cropConfig = array('minWidth' => 1, 'minHeight' => 1, 'aspectRatio' => true, 'cropRoute' => 'comur_api_crop', 'forceResize' => true, 'thumbs' => null);
     $resolver->setDefaults(array('uploadConfig' => $uploadConfig, 'cropConfig' => $cropConfig, 'inherit_data' => true, 'help' => null, 'show_fade' => false));
     $resolver->setOptional(array('help', 'show_fade', 'image_checker', 'image_path'));
     $isGallery = $this->isGallery;
     $galleryDir = $this->galleryDir;
     $resolver->setNormalizers(array('uploadConfig' => function (Options $options, $value) use($uploadConfig, $isGallery, $galleryDir) {
         $config = array_merge($uploadConfig, $value);
         if ($isGallery) {
             $config['uploadUrl'] = $config['uploadUrl'] . '/' . $galleryDir;
             $config['webDir'] = $config['webDir'] . '/' . $galleryDir;
             $config['saveOriginal'] = false;
         }
         if (!isset($config['libraryDir'])) {
             $config['libraryDir'] = $config['uploadUrl'];
         }
         // if($config['saveOriginal']){
         //     $options['compound']=true;
         // }
         return $config;
     }, 'cropConfig' => function (Options $options, $value) use($cropConfig) {
         return array_merge($cropConfig, $value);
     }));
 }
Example #8
0
 protected function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('unicode' => true, 'milliseconds' => 200, 'symbol-size' => 'square-auto', 'process-timeout' => 600, 'command' => 'dmtxread'));
     $resolver->setOptional(array('newline', 'unicode', 'milliseconds', 'codewords', 'minimum-edge', 'maximum-edge', 'gap', 'page', 'square-deviation', 'resolution', 'symbol-size', 'threshold', 'x-range-min', 'x-range-max', 'y-range-min', 'y-range-max', 'corrections-max', 'diagnose', 'mosaic', 'stop-after', 'page-numbers', 'corners', 'shrink'));
     $resolver->setAllowedValues(array('symbol-size' => array('square-auto', 'rectangle-auto', '10x10', '24x24', '64x64')));
     $resolver->setAllowedTypes(array('newline' => 'bool', 'unicode' => 'bool', 'milliseconds' => 'integer', 'codewords' => 'bool', 'minimum-edge' => 'integer', 'maximum-edge' => 'integer', 'gap' => 'integer', 'page' => 'integer', 'square-deviation' => 'integer', 'resolution' => 'integer', 'threshold' => 'integer', 'corrections-max' => 'integer', 'diagnose' => 'bool', 'mosaic' => 'bool', 'stop-after' => 'integer', 'page-numbers' => 'bool', 'corners' => 'bool', 'shrink' => 'integer'));
 }
 /**
  * {@inheritdoc}
  */
 public function configureResolver(OptionsResolverInterface $resolver)
 {
     $patientNormalizer = function (Options $options, $value) {
         static $resource;
         if (!$resource) {
             $resource = $options['patient_resource']->getRepository();
         }
         return $resource->getByMRN($value);
     };
     $codes = $this->getCodes();
     $diagnosisNormalizer = function (Options $options, $value) use($codes) {
         static $resource;
         if (!$resource) {
             $resource = $options['diagnosis_resource']->getRepository();
         }
         if ($patient = $options['patient']) {
             foreach ($patient->getDiagnoses() as $diagnosis) {
                 if (in_array($diagnosis->getCode()->getCode(), $codes)) {
                     return $diagnosis;
                 }
             }
         }
     };
     $dateNormalizer = function (Options $options, $value) {
         return empty($value) ? null : new DateTime($value);
     };
     $resolver->setRequired(array('patient', 'activity_date'));
     $resolver->setOptional(array('diagnosis'));
     $resolver->setAllowedTypes(array('patient' => array('string'), 'diagnosis' => array('Accard\\Component\\Diagnosis\\Model\\DiagnosisInterface', 'null'), 'activity_date' => array('string', 'null')));
     $resolver->setNormalizers(array('patient' => $patientNormalizer, 'diagnosis' => $diagnosisNormalizer, 'activity_date' => $dateNormalizer));
 }
Example #10
0
 function it_should_define_assigned_data_class(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('data_class' => 'Rule', 'validation_groups' => array('sylius')))->shouldBeCalled();
     $resolver->setOptional(array('configuration_type'))->shouldBeCalled();
     $resolver->setDefaults(array('configuration_type' => RuleInterface::TYPE_ITEM_TOTAL))->shouldBeCalled();
     $this->setDefaultOptions($resolver);
 }
Example #11
0
 /**
  * {@inheritdoc}
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['name']);
     $resolver->setOptional(['label', 'class', 'repeat_min', 'repeat_max', 'property_path', 'dependencies', 'filters', 'rules']);
     $resolver->setDefaults(['property_path' => null, 'dependencies' => [], 'filters' => [], 'rules' => []]);
     $resolver->setAllowedTypes(['name' => ['int', 'string'], 'label' => 'string', 'class' => 'string', 'repeat_min' => ['int', 'string'], 'repeat_max' => ['int', 'string'], 'dependencies' => 'array']);
 }
Example #12
0
 protected function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('encoding' => 'ascii', 'module' => 5, 'symbol-size' => 'square-auto', 'format' => 'png', 'message-separator' => ' ', 'process-timeout' => 600, 'command' => 'dmtxwrite'));
     $resolver->setOptional(array('resolution', 'margin'));
     $resolver->setAllowedValues(array('encoding' => array('best', 'fast', 'ascii', 'c40', 'text', 'x12', 'edifact', '8base256'), 'format' => array('png', 'tif', 'gif', 'pdf'), 'symbol-size' => array('square-auto', 'rectangle-auto', '10x10', '24x24', '64x64')));
     $resolver->setAllowedTypes(array('resolution' => 'integer', 'module' => 'integer', 'margin' => 'integer'));
 }
Example #13
0
 /**
  * {@inheritdoc}
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['name', 'label', 'prefixes']);
     $resolver->setDefaults(['prefixes' => ['net', 'gross']]);
     $resolver->setOptional(['vat_field', 'comment', 'suffix', 'prefix', 'selector', 'wrap', 'class', 'css_attribute', 'max_length', 'error', 'rules', 'filters', 'dependencies', 'default']);
     $resolver->setAllowedTypes(['name' => 'string', 'label' => 'string', 'comment' => 'string', 'suffix' => 'string', 'prefix' => 'string', 'selector' => 'string', 'wrap' => 'string', 'class' => 'string', 'css_attribute' => 'string', 'max_length' => 'integer', 'error' => 'string', 'filters' => 'array', 'rules' => 'array', 'dependencies' => 'array', 'default' => ['string', 'integer']]);
 }
Example #14
0
 function it_should_configure_the_resolver(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('format' => Argument::any(), 'language' => \Locale::getDefault(), 'leading_zero' => false))->shouldBeCalled();
     $resolver->setOptional(array('placeholder', 'language', 'leading_zero'))->shouldBeCalled();
     $resolver->setAllowedTypes(array('placeholder' => array('string'), 'language' => array('string'), 'leading_zero' => array('bool')))->shouldBeCalled();
     $this->setDefaultOptions($resolver);
 }
Example #15
0
 function it_should_define_assigned_data_class(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('data_class' => 'Action', 'validation_groups' => array('sylius')))->shouldBeCalled();
     $resolver->setOptional(array('configuration_type'))->shouldBeCalled();
     $resolver->setDefaults(array('configuration_type' => ActionInterface::TYPE_FIXED_DISCOUNT))->shouldBeCalled();
     $this->setDefaultOptions($resolver);
 }
Example #16
0
 /**
  * {@inheritdoc}
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['name', 'label']);
     $resolver->setOptional(['rows', 'comment', 'suffix', 'prefix', 'selector', 'wrap', 'class', 'css_attribute', 'max_length', 'error', 'rules', 'filters', 'dependencies', 'default', 'property_path', 'transformer']);
     $resolver->setDefaults(['dependencies' => [], 'filters' => [], 'rules' => [], 'transformer' => null, 'property_path' => null]);
     $resolver->setAllowedTypes(['name' => 'string', 'rows' => 'int', 'label' => 'string', 'comment' => 'string', 'suffix' => 'string', 'prefix' => 'string', 'selector' => 'string', 'wrap' => 'string', 'class' => 'string', 'css_attribute' => 'string', 'max_length' => 'integer', 'error' => 'string', 'filters' => 'array', 'rules' => 'array', 'dependencies' => 'array', 'default' => ['string', 'integer']]);
 }
Example #17
0
 /**
  * {@inheritdoc}
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['name', 'label', 'property_path']);
     $resolver->setOptional(['class', 'error', 'comment', 'default', 'filters', 'rules', 'transformer']);
     $resolver->setDefaults(['dependencies' => [], 'filters' => [], 'rules' => [], 'property_path' => null, 'transformer' => null]);
     $resolver->setAllowedTypes(['name' => 'string', 'label' => 'string', 'class' => 'string', 'error' => 'string', 'comment' => 'string', 'default' => ['string', 'integer'], 'property_path' => ['null', 'object'], 'transformer' => ['null', 'object']]);
 }
Example #18
0
 /**
  * {@inheritdoc}
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['name', 'label']);
     $resolver->setOptional(['options', 'comment', 'suffix', 'prefix', 'error', 'selector', 'css_attribute', 'addable', 'onAdd', 'add_item_prompt', 'default', 'property_path', 'dependencies', 'filters', 'rules', 'transformer']);
     $resolver->setDefaults(['options' => [], 'dependencies' => [], 'filters' => [], 'rules' => [], 'property_path' => null, 'transformer' => null]);
     $resolver->setAllowedTypes(['name' => 'string', 'label' => 'string', 'options' => 'array', 'comment' => 'string', 'suffix' => 'string', 'prefix' => 'string', 'error' => 'string', 'selector' => 'string', 'css_attribute' => 'string', 'addable' => 'bool', 'onAdd' => 'string', 'add_item_prompt' => 'string', 'default' => ['string', 'integer'], 'rules' => 'array', 'dependencies' => 'array', 'property_path' => ['null', 'object'], 'transformer' => ['null', 'object']]);
 }
Example #19
0
 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setOptional(array('image_path', 'aspect_ratio'));
     // $resolver->setDefaults(array(
     //     'aspect_ratio' => 1
     // ));
 }
Example #20
0
 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['rows_per_page', 'key']);
     $resolver->setOptional(['default_sorting', 'right_click_menu', 'auto_suggest_delay', 'auto_suggest_min_length', 'auto_suggest_suggestions', 'only_one_selected', 'no_column_modification', 'no_column_resizing', 'create_input', 'save_column_modification', 'persistent']);
     $resolver->setDefaults(['rows_per_page' => 50, 'key' => 'id']);
     $resolver->setAllowedTypes(['rows_per_page' => 'int', 'key' => ['int', 'string'], 'default_sorting' => ['int', 'string'], 'right_click_menu' => 'bool', 'auto_suggest_delay' => 'int', 'auto_suggest_min_length' => 'int', 'auto_suggest_suggestions' => 'int', 'only_one_selected' => 'bool', 'no_column_modification' => 'bool', 'no_column_resizing' => 'bool', 'create_input' => 'bool', 'save_column_modification' => 'bool', 'persistent' => 'bool']);
 }
Example #21
0
 /**
  * {@inheritdoc}
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['name', 'label']);
     $resolver->setOptional(['comment', 'comment', 'repeat_min', 'repeat_max', 'limit', 'error', 'rules', 'filters', 'dependencies', 'main_id', 'visibility_change', 'upload_url', 'session_name', 'session_id', 'file_types', 'file_types_description', 'delete_handler', 'load_handler', 'property_path', 'dependencies', 'filters', 'rules']);
     $resolver->setDefaults(['repeat_min' => 0, 'repeat_max' => ElementInterface::INFINITE, 'limit' => 1000, 'session_name' => session_name(), 'session_id' => session_id(), 'file_types_description' => 'file_types_description', 'file_types' => ['jpg', 'jpeg', 'png', 'gif'], 'property_path' => null, 'dependencies' => [], 'filters' => [], 'rules' => []]);
     $resolver->setAllowedTypes(['file_types_description' => 'string', 'file_types' => 'array']);
 }
Example #22
0
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('label' => 'user.security.roles', 'multiple' => true, 'expanded' => true, 'choices' => array_combine($this->roles, array_map(function ($role) {
         return 'roles.' . $role;
     }, $this->roles)), 'attr' => array('class' => 'dp-security-roles'), 'required' => false));
     $resolver->setOptional(array('roles'));
 }
 /**
  * {@inheritDoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     // Endpoint mandatory for fileupload bundle
     $resolver->setRequired(array('endpoint'));
     $resolver->setOptional(array('download_link', 'remove_link', 'loading_file', 'resolver_key'));
     $resolver->setDefaults(array('download_link' => true, 'remove_link' => true, 'loading_file' => 'bundles/jbfileuploader/img/ajax-loader-small.gif', 'resolver_key' => 'upload_resolver'));
 }
Example #24
0
 /**
  * Configures admin menu item options
  *
  * @param OptionsResolverInterface $resolver
  */
 public function configureOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['id', 'name', 'link', 'path']);
     $resolver->setOptional(['class', 'sort_order']);
     $resolver->setDefaults(array('sort_order' => 0, 'class' => '', 'link' => ''));
     $resolver->setAllowedTypes(array('id' => 'string', 'name' => 'string', 'link' => 'string', 'class' => 'string', 'sort_order' => 'integer'));
 }
Example #25
0
 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['column_select', 'column_options']);
     $resolver->setOptional(['header', 'filter', 'footer', 'max_height']);
     $resolver->setDefaults(['column_select' => false, 'column_options' => true]);
     $resolver->setAllowedTypes(['header' => 'bool', 'filter' => 'bool', 'footer' => 'bool', 'column_select' => 'bool', 'column_options' => 'bool', 'max_height' => 'int']);
 }
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(array('entityName'));
     $resolver->setRequired(array('route'));
     $resolver->setOptional(array('autosuggestMethod', 'valueMethod', 'route_parameters'));
     $resolver->setDefaults(array('invalid_message' => 'Entity does not exists', 'autosuggestMethod' => 'autocomplete', 'valueMethod' => 'id', 'route_parameters' => array()));
 }
Example #27
0
 /**
  * @param OptionsResolverInterface $resolver
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $factory = $this->factory;
     $resolver->setDefaults(['choices' => function (Options $options) use($factory) {
         return $factory->getInstalledThemes($options['feature']);
     }, 'expanded' => false, 'multiple' => false, 'label' => 'mautic.core.form.theme', 'label_attr' => ['class' => 'control-label'], 'empty_value' => false, 'required' => false, 'attr' => ['class' => 'form-control'], 'feature' => 'all']);
     $resolver->setOptional(['feature']);
 }
Example #28
0
 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(['data_class' => 'MauticPlugin\\MauticSocialBundle\\Entity\\Monitoring']);
     // allow network types to be sent through - list
     $resolver->setRequired(['networkTypes']);
     // allow the specific network type - single
     $resolver->setOptional(['networkType']);
 }
Example #29
0
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     // config_is_new is true if a new entity or field is created
     // note that this option is false if entity or field is edited even if its state is New
     // (extend.state is ExtendScope::STATE_NEW)
     $resolver->setOptional(['config_id', 'config_is_new']);
     $resolver->setAllowedTypes(['config_id' => ['Oro\\Bundle\\EntityConfigBundle\\Config\\Id\\EntityConfigId', 'Oro\\Bundle\\EntityConfigBundle\\Config\\Id\\FieldConfigId']]);
 }
Example #30
0
 /**
  * {@inheritdoc}
  */
 public function configureAttributes(OptionsResolverInterface $resolver)
 {
     $resolver->setRequired(['name', 'label']);
     $resolver->setOptional(['addLabel', 'error', 'selectable', 'error', 'selector', 'choosable', 'clickable', 'deletable', 'sortable', 'retractable', 'addable', 'total', 'restrict', 'items', 'onClick', 'onDuplicate', 'onAdd', 'onAfterAdd', 'onDelete', 'onAfterDelete', 'onSaveOrder', 'active', 'onAfterDeleteId', 'add_item_prompt', 'getchildren', 'prevent_duplicates', 'prevent_duplicates_on_all_levels', 'set', 'rules', 'dependencies', 'clickable_root']);
     $resolver->setDefaults(['dependencies' => [], 'filters' => [], 'rules' => [], 'total' => function (Options $options) {
         return count($options['items']);
     }, 'property_path' => null, 'transformer' => null]);
     $resolver->setAllowedTypes(['name' => ['int', 'string'], 'label' => 'string', 'addLabel' => 'string', 'error' => 'string', 'selectable' => 'bool', 'selector' => 'string', 'choosable' => 'bool', 'clickable' => 'bool', 'deletable' => 'bool', 'sortable' => 'bool', 'retractable' => 'bool', 'addable' => 'bool', 'total' => 'int', 'restrict' => ['bool', 'array', 'int', 'string'], 'items' => ['array', 'null'], 'onClick' => 'string', 'onDuplicate' => 'string', 'onAdd' => 'string', 'onAfterAdd' => 'string', 'onDelete' => 'string', 'onAfterDelete' => 'string', 'onSaveOrder' => 'string', 'active' => ['string', 'array', 'int'], 'onAfterDeleteId' => 'int', 'add_item_prompt' => 'string', 'getchildren' => 'object', 'prevent_duplicates' => 'bool', 'prevent_duplicates_on_all_levels' => 'bool', 'clickable_root' => 'bool', 'set' => 'string', 'rules' => 'array', 'dependencies' => 'array']);
 }