Esempio n. 1
0
 public function testCloneDoesCloneInnerValue()
 {
     $this->object->set(96);
     $clone = clone $this->object;
     $clone->set(104);
     $this->assertNotEquals($clone(), $this->object->get());
 }
Esempio n. 2
0
 /**
  * These are the values set when no parameters are given into the 
  * contructor
  *
  * @depends	testInterface
  * @return	null
  */
 public function testDefaultZeroFillDisplayWidthAutoIncrement()
 {
     $this->assertNull($this->type->getDisplayWidth());
     $this->assertFalse($this->type->isZeroFill());
     $this->assertFalse($this->type->isUnsigned());
     $this->assertFalse($this->type->isAutoIncrement());
 }
Esempio n. 3
0
 /**
  * get additional options for edit form
  *
  * @return array
  */
 public function getAdditionalEditFormOptions()
 {
     $options = parent::getAdditionalEditFormOptions();
     $underscore = $this->getUnderscore();
     $options[] = '\'values\' => array_merge([\'\' => \'\'], $this->' . $underscore . 'countryOptions->toOptionArray()),';
     return $options;
 }
 /**
  * Sets level
  * @param int $level
  */
 public function setLevel($level)
 {
     parent::setLevel($level);
     foreach ($this->items as $item) {
         $item->setLevel($level + 1);
     }
 }
Esempio n. 5
0
 /**
  * get addition option for edit form
  *
  * @return array
  */
 public function getAdditionalEditFormOptions()
 {
     $options = parent::getAdditionalEditFormOptions();
     $underscore = $this->getUnderscore();
     $options[] = '\'values\' => $this->' . $underscore . 'booleanOptions->toOptionArray(),';
     return $options;
 }
Esempio n. 6
0
 public function __construct($name, $label, $options = null)
 {
     parent::__construct($name, $label, $options);
     $this->setView('administr/form::submit');
     $this->options['type'] = 'submit';
     $this->setValue($label);
 }
Esempio n. 7
0
 public function render(array $attributes = [], array $viewData = [])
 {
     $this->options = array_merge($this->options, $attributes);
     $this->options['value'] = $this->getName();
     $this->value = $this->getName();
     return parent::render($attributes, $viewData);
 }
Esempio n. 8
0
 /**
  * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $attrSetColFac
  * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $prodAttrColFac
  * @param array $params
  * @param \Magento\ImportExport\Model\ImportFactory $importFactory
  * @param \Magento\Catalog\Model\Resource\Product\LinkFactory $productLinkFactory
  * @param \Magento\Framework\App\Resource $resource
  */
 public function __construct(\Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $attrSetColFac, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $prodAttrColFac, array $params, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\Catalog\Model\Resource\Product\LinkFactory $productLinkFactory, \Magento\Framework\App\Resource $resource)
 {
     $this->_importFactory = $importFactory;
     $this->_resource = $resource;
     $this->_productLinkFactory = $productLinkFactory;
     parent::__construct($attrSetColFac, $prodAttrColFac, $params);
 }
Esempio n. 9
0
 public function setValue($value)
 {
     foreach ($this->checkboxes as $checkbox) {
         $checkbox->setValue($value);
     }
     return parent::setValue($value);
 }
Esempio n. 10
0
 public function setValue($value)
 {
     foreach ($this->radios as $radio) {
         $radio->setValue($value);
     }
     return parent::setValue($value);
 }
Esempio n. 11
0
 /**
  * get addition option for edit form
  *
  * @return array
  */
 public function getAdditionalEditFormOptions()
 {
     if ($this->getAttribute()->getData('editor')) {
         $underscore = $this->getUnderscore();
         return ['\'config\'    => $this->' . $underscore . 'wysiwygConfig->getConfig()'];
     }
     return parent::getAdditionalEditFormOptions();
 }
Esempio n. 12
0
 public function render(array $attributes = [], array $viewData = [])
 {
     $this->options = array_merge($this->options, $attributes);
     $value = old(str_replace('[]', '', $this->name), $this->getOption('value'));
     unset($this->options['value']);
     $this->setSelectOptions($value);
     return parent::render($attributes, $viewData);
 }
Esempio n. 13
0
 /**
  * @return array
  */
 public function toMapping()
 {
     $fieldsMapping = [];
     foreach ($this->fields as $field) {
         $fieldsMapping[$field->getName()] = $field->toMapping();
     }
     return ['fields' => $fieldsMapping] + parent::toMapping();
 }
 public function __construct()
 {
     parent::__construct();
     $this->headers = array();
     $this->rows = array();
     $this->columnMaxWidth = array();
     $this->title = '';
 }
Esempio n. 15
0
 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setRequired(['resource', 'type'])->setDefaults(['options' => [], 'resource_path' => function (Options $options, $resourcePath) {
         return $resourcePath === null ? $options['resource']->getLabelPropertyPath() : $resourcePath;
     }])->setNormalizer('resource', function (Options $options, $resource) {
         return is_string($resource) ? $this->resourceRegistry[$resource] : $resource;
     })->setAllowedTypes('resource', ['string', ResourceInterface::class])->setAllowedTypes('resource_path', 'string')->setAllowedTypes('type', 'string')->setAllowedTypes('options', 'array');
 }
Esempio n. 16
0
 /**
  * @return array
  */
 public function getPlaceholders()
 {
     $placeholders = parent::getPlaceholders();
     $attribute = $this->getAttribute();
     $entity = $attribute->getEntity();
     $module = $entity->getModule();
     $placeholders['{{GridFilterSourceClass}}'] = $module->getNamespace() . '\\' . $module->getModuleName() . '\\Model\\' . $entity->getNameSingular(true) . '\\Source\\' . $attribute->getCodeCamelCase(true);
     return $placeholders;
 }
Esempio n. 17
0
 public function handleCommand($command, $data = null)
 {
     switch (strtolower($command)) {
         case 'default':
             $this->setDefault($value);
             return $this;
     }
     return parent::handleCommand($command, $data);
 }
 protected function buildFormOptions()
 {
     $options = parent::buildFormOptions();
     if (isset($options['constraints'])) {
         $options['file_options'] = array_merge(isset($options['file_options']) ? $options['file_options'] : array(), array('constraints' => $options['constraints']));
         unset($options['constraints']);
     }
     return $options;
 }
Esempio n. 19
0
 /**
  * @param array $data accepts min, max
  */
 public function __construct($data)
 {
     if (isset($data['min'])) {
         $this->min = $data['min'];
     }
     if (isset($data['max'])) {
         $this->max = $data['max'];
     }
     parent::__construct($data);
 }
Esempio n. 20
0
 public function handleCommand($command, $data = null)
 {
     switch (strtolower($command)) {
         case 'default':
             if (!in_array($data, array('0', '1', 'true', 'false'))) {
                 throw new \SwaggerGen\Exception("Invalid boolean default: '{$data}'");
             }
             $this->default = $data == '1' || strtolower($data) === 'true';
             return $this;
     }
     return parent::handleCommand($command, $data);
 }
Esempio n. 21
0
 /**
  * get addition option for edit form
  *
  * @return array
  */
 public function getAdditionalEditFormOptions()
 {
     $options = parent::getAdditionalEditFormOptions();
     $attribute = $this->getAttribute();
     $underscore = $this->getUnderscore();
     if ($attribute->getForcedSourceModel()) {
         $sourceModel = $attribute->getForcedSourceModel();
     } else {
         $sourceModel = $attribute->getCodeCamelCase() . 'Options';
     }
     $options[] = '\'values\' => array_merge([\'\' => \'\'], $this->' . $underscore . $sourceModel . '->toOptionArray()),';
     return $options;
 }
Esempio n. 22
0
 /**
  * Constructor.
  *
  * @param string $name
  * @param array $types
  * @param callable|null $typeResolver
  * @param string|null $description
  */
 public function __construct($name, array $types = [], callable $typeResolver = NULL, $description = NULL)
 {
     parent::__construct($name, $description);
     $nonObjectTypes = array_filter($types, function (TypeInterface $type) {
         return !$type instanceof ObjectType;
     });
     if (!empty($nonObjectTypes)) {
         $nonObjectTypes = implode(', ', array_map(function ($type) {
             return (string) $type;
         }, $nonObjectTypes));
         throw new \LogicException(sprintf('Union %s may only contain object types, it cannot contain: %s.', (string) $this, $nonObjectTypes));
     }
     $this->types = $types;
     $this->typeResolver = $typeResolver;
 }
Esempio n. 23
0
 public function handleCommand($command, $data = null)
 {
     switch (strtolower($command)) {
         case 'default':
             $this->default = $data;
             return $this;
         case 'pattern':
             $this->pattern = $data;
             return $this;
         case 'enum':
             $words = self::words_split($data);
             $this->enum = is_array($this->enum) ? array_merge($this->enum, $words) : $words;
             return $this;
     }
     return parent::handleCommand($command, $data);
 }
Esempio n. 24
0
 public function handleCommand($command, $data = null)
 {
     switch (strtolower($command)) {
         case 'default':
             $this->default = $this->validateDefault($data);
             return $this;
         case 'enum':
             $words = self::words_split($data);
             foreach ($words as &$word) {
                 $word = $this->validateDefault($word);
             }
             $this->enum = array_merge($this->enum, $words);
             return $this;
         case 'step':
             if (($step = intval($data)) > 0) {
                 $this->multipleOf = $step;
             }
             return $this;
     }
     return parent::handleCommand($command, $data);
 }
Esempio n. 25
0
 public function handleCommand($command, $data = null)
 {
     switch (strtolower($command)) {
         // type name description...
         case 'property':
         case 'property?':
             $definition = self::words_shift($data);
             $name = self::words_shift($data);
             $this->properties[$name] = new Property($this, $definition, $data);
             if (substr($command, -1) !== '?') {
                 $this->required[] = $name;
             }
             return $this;
         case 'min':
             $this->minProperties = intval($data);
             return $this;
         case 'max':
             $this->maxProperties = intval($data);
             return $this;
     }
     return parent::handleCommand($command, $data);
 }
Esempio n. 26
0
 public function __construct($name, $label, $options = null)
 {
     parent::__construct($name, $label, $options);
     $this->setView('administr/form::text');
     $this->options['type'] = 'password';
 }
Esempio n. 27
0
 /**
  * @return array
  */
 public function getPlaceholders()
 {
     $placeholders = parent::getPlaceholders();
     $placeholders['{{GridFilterSourceClass}}'] = $this->getSourceModel();
     return $placeholders;
 }
Esempio n. 28
0
 /**
  * {@inheritdoc}
  */
 protected function validate($data, array $options)
 {
     return parent::validate($data, $options) && is_array($data) && isset($data['type']) && (in_array($data['type'], self::getSimpleTypes(), true) && isset($data['value']) && is_string($data['value']) || in_array($data['type'], self::getEmptyTypes(), true));
 }
Esempio n. 29
0
 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(['options' => $this->options, 'depth' => $this->depth])->setAllowedTypes('options', 'integer')->setAllowedTypes('depth', 'integer');
 }
Esempio n. 30
0
 /**
  * get header class for admin grid
  *
  * @return string
  */
 public function getGridHeaderClass()
 {
     return trim('col-period ' . parent::getGridHeaderClass());
 }