public function testCloneDoesCloneInnerValue() { $this->object->set(96); $clone = clone $this->object; $clone->set(104); $this->assertNotEquals($clone(), $this->object->get()); }
/** * 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()); }
/** * 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); } }
/** * 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; }
public function __construct($name, $label, $options = null) { parent::__construct($name, $label, $options); $this->setView('administr/form::submit'); $this->options['type'] = 'submit'; $this->setValue($label); }
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); }
/** * @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); }
public function setValue($value) { foreach ($this->checkboxes as $checkbox) { $checkbox->setValue($value); } return parent::setValue($value); }
public function setValue($value) { foreach ($this->radios as $radio) { $radio->setValue($value); } return parent::setValue($value); }
/** * 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(); }
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); }
/** * @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 = ''; }
/** * {@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'); }
/** * @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; }
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; }
/** * @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); }
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); }
/** * 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; }
/** * 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; }
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); }
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); }
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); }
public function __construct($name, $label, $options = null) { parent::__construct($name, $label, $options); $this->setView('administr/form::text'); $this->options['type'] = 'password'; }
/** * @return array */ public function getPlaceholders() { $placeholders = parent::getPlaceholders(); $placeholders['{{GridFilterSourceClass}}'] = $this->getSourceModel(); return $placeholders; }
/** * {@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)); }
/** * {@inheritdoc} */ public function configureOptions(OptionsResolver $resolver) { parent::configureOptions($resolver); $resolver->setDefaults(['options' => $this->options, 'depth' => $this->depth])->setAllowedTypes('options', 'integer')->setAllowedTypes('depth', 'integer'); }
/** * get header class for admin grid * * @return string */ public function getGridHeaderClass() { return trim('col-period ' . parent::getGridHeaderClass()); }