prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
buted with this source code.
*/
namespace Symfony\Component\Form;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\Flow\ButtonFlowBuilder;
use Symfony\Component\Form\Flow\ButtonFlowTypeInterface;
use Symfony\Component\Form... | []
*/
private array $typeExtensions;
private OptionsResolver $optionsResolver;
/**
* @param FormTypeExtensionInterface[] $typeExtensions
*/
public function __construct(
private FormTypeInterface $innerType,
| esolver;
/**
* A wrapper for a form type and its extensions.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class ResolvedFormType implements ResolvedFormTypeInterface
{
/**
* @var FormTypeExtensionInterface | {
"filepath": "src/Symfony/Component/Form/ResolvedFormType.php",
"language": "php",
"file_size": 5709,
"cut_index": 716,
"middle_length": 229
} |
ge.
*
* (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\OptionsResolver\OptionsResolver;
/**
* A wrapper for a form type and its e... | TypeInterface;
/**
* Returns the extensions of the wrapped form type.
*
* @return FormTypeExtensionInterface[]
*/
public function getTypeExtensions(): array;
/**
* Creates a new form builder for this type.
*
| public function getBlockPrefix(): string;
/**
* Returns the parent type.
*/
public function getParent(): ?self;
/**
* Returns the wrapped form type.
*/
public function getInnerType(): Form | {
"filepath": "src/Symfony/Component/Form/ResolvedFormTypeInterface.php",
"language": "php",
"file_size": 2158,
"cut_index": 563,
"middle_length": 229
} |
hp
/*
* 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;
/**
* A button that submits the form.
*
* @auth... | ction submit(array|string|null $submittedData, bool $clearMissing = true): static
{
if ($this->getConfig()->getDisabled()) {
$this->clicked = false;
return $this;
}
parent::submit($submittedData, $clear |
return $this->clicked;
}
/**
* Submits data to the button.
*
* @return $this
*
* @throws Exception\AlreadySubmittedException if the form has already been submitted
*/
public fun | {
"filepath": "src/Symfony/Component/Form/SubmitButton.php",
"language": "php",
"file_size": 1092,
"cut_index": 515,
"middle_length": 229
} |
ge.
*
* (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\Flow;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Flow\Type\FormFlowType;
u... | {
throw new \InvalidArgumentException(\sprintf('The "%s" can only be used with FormFlowType.', self::class));
}
$this->buildFormFlow($builder, $options);
}
final public function buildView(FormView $view, FormInterface | s AbstractFlowType extends AbstractType implements FormFlowTypeInterface
{
final public function buildForm(FormBuilderInterface $builder, array $options): void
{
if (!$builder instanceof FormFlowBuilderInterface) | {
"filepath": "src/Symfony/Component/Form/Flow/AbstractFlowType.php",
"language": "php",
"file_size": 2087,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Flow;
use Symfony\Component\Form\ClickableInterface;
use Symfony\Component\Form\Exception\AlreadySubmittedException;
use Symfony\Component\Form\Exception\InvalidArgumentException;
use Symfony\Component\Form\Exception\RuntimeException;
use Symfony\Compo... | nished = false;
public function __construct(
private readonly FormFlowConfigInterface $config,
private FormFlowCursor $cursor,
) {
parent::__construct($config);
}
public function submit(mixed $submittedData, bool $ | Ceruto <open@yceruto.dev>
*
* @implements \IteratorAggregate<string, FormInterface>
*/
class FormFlow extends Form implements FormFlowInterface
{
private ?ButtonFlowInterface $clickedFlowButton = null;
private bool $fi | {
"filepath": "src/Symfony/Component/Form/Flow/FormFlow.php",
"language": "php",
"file_size": 7280,
"cut_index": 716,
"middle_length": 229
} |
ge.
*
* (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\Flow;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\Flow\Data... | eateStep(string $name, string $type = FormType::class, array $options = []): StepFlowBuilderConfigInterface;
/**
* Adds a step to the form flow.
*/
public function addStep(StepFlowBuilderConfigInterface|string $name, string $type = FormT | v>
*
* @extends \Traversable<string, FormBuilderInterface>
*/
interface FormFlowBuilderInterface extends FormBuilderInterface, FormFlowConfigInterface
{
/**
* Creates a new step builder.
*/
public function cr | {
"filepath": "src/Symfony/Component/Form/Flow/FormFlowBuilderInterface.php",
"language": "php",
"file_size": 2129,
"cut_index": 563,
"middle_length": 229
} |
ge.
*
* (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\Flow;
use Symfony\Component\Form\Exception\InvalidArgumentException;
/**
* @author Yonel Ceruto <... | eps)));
}
}
public function getSteps(): array
{
return $this->steps;
}
public function getTotalSteps(): int
{
return \count($this->steps);
}
public function getStepIndex(): int
{
return | string $currentStep,
) {
if (!\in_array($currentStep, $steps, true)) {
throw new InvalidArgumentException(\sprintf('Step "%s" does not exist. Available steps are: "%s".', $currentStep, implode('", "', $st | {
"filepath": "src/Symfony/Component/Form/Flow/FormFlowCursor.php",
"language": "php",
"file_size": 2417,
"cut_index": 563,
"middle_length": 229
} |
ge.
*
* (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\Flow;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\Form\FormView;
/**
* A ... | ldFormFlow(FormFlowBuilderInterface $builder, array $options): void;
/**
* Builds the multistep form view.
*
* This method is called for each multistep type. Type extensions can further
* modify the view.
*
* A view of a | lds the multistep form.
*
* This method is called for each multistep type. Type extensions can further
* modify the multistep form.
*
* @param array<string, mixed> $options
*/
public function bui | {
"filepath": "src/Symfony/Component/Form/Flow/FormFlowTypeInterface.php",
"language": "php",
"file_size": 2086,
"cut_index": 563,
"middle_length": 229
} |
hp
/*
* 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\Flow;
/**
* @author Yonel Ceruto <open@yceruto.dev... | rity of the step.
*/
public function setPriority(int $priority): static;
/**
* Sets the closure that determines if the step should be skipped.
*/
public function setSkip(?\Closure $skip): static;
/**
* Returns a StepFl | /**
* Returns the form options for the step.
*/
public function getOptions(): array;
/**
* Returns the priority of the step.
*/
public function getPriority(): int;
/**
* Sets the prio | {
"filepath": "src/Symfony/Component/Form/Flow/StepFlowBuilderConfigInterface.php",
"language": "php",
"file_size": 1113,
"cut_index": 515,
"middle_length": 229
} |
ge.
*
* (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\Flow\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\... | ic function configureOptions(OptionsResolver $resolver): void
{
$resolver->define('handler')
->info('The callable that will be called when this button is clicked')
->required()
->allowedTypes('callable');
| sResolver\OptionsResolver;
/**
* A submit button with a callable handler for a form flow.
*
* @author Yonel Ceruto <open@yceruto.dev>
*/
class ButtonFlowType extends AbstractType implements ButtonFlowTypeInterface
{
publ | {
"filepath": "src/Symfony/Component/Form/Flow/Type/ButtonFlowType.php",
"language": "php",
"file_size": 2092,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form;
/**
* Adapter for rendering form templates with a specific templating engine.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface FormRendererEngineInterface
{
/**
* Sets the theme(s) to be used for rendering a view and its c... | n the themes attached to $view, then
* in the themes of its parent view and so on, until a resource was found.
*
* The type of the resource is decided by the implementation. The resource
* is later passed to {@link renderBlock()} by the | o the implementation.
*/
public function setTheme(FormView $view, mixed $themes, bool $useDefaultThemes = true): void;
/**
* Returns the resource for a block name.
*
* The resource is first searched i | {
"filepath": "src/Symfony/Component/Form/FormRendererEngineInterface.php",
"language": "php",
"file_size": 6214,
"cut_index": 716,
"middle_length": 229
} |
ge.
*
* (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\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\Guess\Gue... | {
$tmpGuessers = [];
foreach ($guessers as $guesser) {
if (!$guesser instanceof FormTypeGuesserInterface) {
throw new UnexpectedTypeException($guesser, FormTypeGuesserInterface::class);
}
|
/**
* @param FormTypeGuesserInterface[] $guessers
*
* @throws UnexpectedTypeException if any guesser does not implement FormTypeGuesserInterface
*/
public function __construct(iterable $guessers)
| {
"filepath": "src/Symfony/Component/Form/FormTypeGuesserChain.php",
"language": "php",
"file_size": 2675,
"cut_index": 563,
"middle_length": 229
} |
ge.
*
* (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;
/**
* @internal
*/
class MissingDataHandler
{
public readonly \stdClass $missingData;
p... | data): mixed
{
$processedData = $this->handleMissingData($form, $data);
return $processedData === $this->missingData ? $data : $processedData;
}
/**
* Returns `$this->missingData` to signal "nothing to synthesise for this | omits.
*
* Callers may pass `$this->missingData` as the sentinel for "no data submitted". Returns $data
* unchanged when no child synthesises a value.
*/
public function handle(FormInterface $form, mixed $ | {
"filepath": "src/Symfony/Component/Form/MissingDataHandler.php",
"language": "php",
"file_size": 2389,
"cut_index": 563,
"middle_length": 229
} |
/*
* 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;
/**
* Creates ResolvedFormTypeInterface instances.
... | [] $typeExtensions
*
* @throws Exception\UnexpectedTypeException if the types parent {@link FormTypeInterface::getParent()} is not a string
* @throws Exception\InvalidArgumentException if the types parent cannot be retrieved from any extens | ubclasses that are used by the framework.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface ResolvedFormTypeFactoryInterface
{
/**
* Resolves a form type.
*
* @param FormTypeExtensionInterface | {
"filepath": "src/Symfony/Component/Form/ResolvedFormTypeFactoryInterface.php",
"language": "php",
"file_size": 1175,
"cut_index": 518,
"middle_length": 229
} |
ge.
*
* (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\Flow;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\SubmitButton;
/**
* A ... | submit
}
parent::submit($submittedData, $clearMissing);
if ($this->isSubmitted()) {
$this->data = $submittedData;
}
return $this;
}
public function getViewData(): mixed
{
return $ | data = null;
private bool $handled = false;
public function submit(array|string|null $submittedData, bool $clearMissing = true): static
{
if ($this->isSubmitted()) {
return $this; // ignore double | {
"filepath": "src/Symfony/Component/Form/Flow/ButtonFlow.php",
"language": "php",
"file_size": 2190,
"cut_index": 563,
"middle_length": 229
} |
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\Flow;
use Symfony\Component\Form\Flow\DataStorage\DataStorageInterface;
u... | urns the step with the given name.
*/
public function getStep(string $name): StepFlowConfigInterface;
/**
* Returns all steps.
*
* @return array<string, StepFlowConfigInterface>
*/
public function getSteps(): array;
| eruto <open@yceruto.dev>
*/
interface FormFlowConfigInterface extends FormConfigInterface
{
/**
* Checks if a step with the given name exists.
*/
public function hasStep(string $name): bool;
/**
* Ret | {
"filepath": "src/Symfony/Component/Form/Flow/FormFlowConfigInterface.php",
"language": "php",
"file_size": 1688,
"cut_index": 537,
"middle_length": 229
} |
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\Flow;
use Symfony\Component\Form\ClickableInterface;
use Symfony\Componen... | rsor to the initial step.
*/
public function reset(): void;
/**
* Moves back to a previous step in the flow.
*
* @param string|null $step The step to move back to, or null to move back one step
*
* @throws RuntimeExce | * Returns the button used to submit the form.
*/
public function getClickedButton(): ButtonFlowInterface|FormInterface|ClickableInterface|null;
/**
* Resets the flow by clearing stored data and setting the cu | {
"filepath": "src/Symfony/Component/Form/Flow/FormFlowInterface.php",
"language": "php",
"file_size": 2019,
"cut_index": 537,
"middle_length": 229
} |
/*
* 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\Flow\Type;
use Symfony\Component\Form\Flow\AbstractBut... | $builder->setAttribute('action', 'finish');
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'handler' => static fn (mixed $data, ButtonFlowInterface $button, FormFlowInterface | FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class FinishFlowType extends AbstractButtonFlowType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
| {
"filepath": "src/Symfony/Component/Form/Flow/Type/FinishFlowType.php",
"language": "php",
"file_size": 1144,
"cut_index": 518,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form;
/**
* Renders a form into HTML.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface FormRendererInterface
{
/**
* Returns t... |
* @param bool $useDefaultThemes If true, will use default themes specified
* in the renderer
*/
public function setTheme(FormView $view, mixed $themes, bool $useDefaultThemes = true): void;
/** | *
* @param FormView $view The view to assign the theme(s) to
* @param mixed $themes The theme(s). The type of these themes
* is open to the implementation. | {
"filepath": "src/Symfony/Component/Form/FormRendererInterface.php",
"language": "php",
"file_size": 3050,
"cut_index": 614,
"middle_length": 229
} |
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\Form\Exception\InvalidArgumentException;
/**
* A... | rface[][] $typeExtensions The type extensions that the extension should support
*/
public function __construct(
array $types,
private array $typeExtensions,
private ?FormTypeGuesserInterface $typeGuesser = null,
) {
| private array $types = [];
/**
* Creates a new preloaded extension.
*
* @param FormTypeInterface[] $types The types that the extension should support
* @param FormTypeExtensionInte | {
"filepath": "src/Symfony/Component/Form/PreloadedExtension.php",
"language": "php",
"file_size": 1878,
"cut_index": 537,
"middle_length": 229
} |
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\Flow;
use Symfony\Component\Form\ClickableInterface;
use Sym... | .
*/
public function isResetAction(): bool;
/**
* Checks if the button's action is 'previous'.
*/
public function isPreviousAction(): bool;
/**
* Checks if the button's action is 'next'.
*/
public function isN | lable handler.
*/
public function handle(): void;
/**
* Checks if the callable handler was already called.
*/
public function isHandled(): bool;
/**
* Checks if the button's action is 'reset' | {
"filepath": "src/Symfony/Component/Form/Flow/ButtonFlowInterface.php",
"language": "php",
"file_size": 1273,
"cut_index": 524,
"middle_length": 229
} |
?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\Flow\StepAccessor;
use Symfony\Component\Property... | bject|array $data, ?string $default = null): ?string
{
return $this->propertyAccessor->getValue($data, $this->propertyPath) ?: $default;
}
public function setStep(object|array &$data, string $step): void
{
$this->propertyAc | AccessorInterface
{
public function __construct(
private readonly PropertyAccessorInterface $propertyAccessor,
private readonly PropertyPathInterface $propertyPath,
) {
}
public function getStep(o | {
"filepath": "src/Symfony/Component/Form/Flow/StepAccessor/PropertyPathStepAccessor.php",
"language": "php",
"file_size": 1059,
"cut_index": 513,
"middle_length": 229
} |
*
* 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\Form\Exception\BadMethodCallException;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @implements \ArrayAccess<i... | /**
* Is the form attached to this renderer rendered?
*
* Rendering happens when either the widget or the row method was called.
* Row implicitly includes widget, however certain rendering mechanisms
* have to skip widget rendering | to this view.
*/
public array $vars = [
'value' => null,
'attr' => [],
];
/**
* The child views.
*
* @var array<int|string, FormView>
*/
public array $children = [];
| {
"filepath": "src/Symfony/Component/Form/FormView.php",
"language": "php",
"file_size": 3513,
"cut_index": 614,
"middle_length": 229
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form;
/**
* Reverses a transformer.
*
* When the transform() method is called, the reversed transformer's
* reverseTransform() method is called... |
}
public function transform(mixed $value): mixed
{
return $this->reversedTransformer->reverseTransform($value);
}
public function reverseTransform(mixed $value): mixed
{
return $this->reversedTransformer->transfor | taTransformerInterface $reversedTransformer,
) { | {
"filepath": "src/Symfony/Component/Form/ReversedTransformer.php",
"language": "php",
"file_size": 933,
"cut_index": 606,
"middle_length": 52
} |
ge.
*
* (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\Flow;
use Symfony\Component\Form\Exception\BadMethodCallException;
use Symfony\Component\Form\FormT... | private readonly array $options = [],
) {
}
public function getName(): string
{
return $this->name;
}
public function getType(): string
{
if ($this->locked) {
throw new BadMethodCallException('StepF | = 0;
private ?\Closure $skip = null;
/**
* @param class-string<FormTypeInterface> $type
*/
public function __construct(
private readonly string $name,
private readonly string $type,
| {
"filepath": "src/Symfony/Component/Form/Flow/StepFlowBuilder.php",
"language": "php",
"file_size": 2940,
"cut_index": 563,
"middle_length": 229
} |
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\Extension\Validator\Type;
use Symfony\Component\Form\Abstrac... | tion __construct(
private TranslatorInterface $translator,
private ?string $translationDomain = null,
) {
}
public function configureOptions(OptionsResolver $resolver): void
{
$translator = $this->translator;
| acts\Translation\TranslatorInterface;
/**
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
* @author David Badura <d.a.badura@gmail.com>
*/
class UploadValidatorExtension extends AbstractTypeExtension
{
public func | {
"filepath": "src/Symfony/Component/Form/Extension/Validator/Type/UploadValidatorExtension.php",
"language": "php",
"file_size": 1344,
"cut_index": 524,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Exception\LogicException;
use Symfony\Component\Form\Extensio... | lic function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->addViewTransformer(new NumberToLocalizedStringTransformer(
$options['scale'],
$options['grouping'],
$options['rounding_m | use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
class NumberType extends AbstractType
{
pub | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/NumberType.php",
"language": "php",
"file_size": 3174,
"cut_index": 614,
"middle_length": 229
} |
/*
* 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\Extension\Core\Type;
use Symfony\Component\Form\Abstra... | configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'always_empty' => true,
'trim' => false,
'invalid_message' => 'The password is invalid.',
]);
}
public function ge | lic function buildView(FormView $view, FormInterface $form, array $options): void
{
if ($options['always_empty'] || !$form->isSubmitted()) {
$view->vars['value'] = '';
}
}
public function | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/PasswordType.php",
"language": "php",
"file_size": 1153,
"cut_index": 518,
"middle_length": 229
} |
ge.
*
* (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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\... | oLocalizedStringTransformer(
$options['scale'],
$options['type'],
$options['rounding_mode'],
$options['html5']
));
}
public function buildView(FormView $view, FormInterface $form, array $opti | mfony\Component\OptionsResolver\OptionsResolver;
class PercentType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->addViewTransformer(new PercentT | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/PercentType.php",
"language": "php",
"file_size": 2363,
"cut_index": 563,
"middle_length": 229
} |
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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType... | 'invalid_message' => 'Please select a valid option.',
]);
}
public function getParent(): ?string
{
return CheckboxType::class;
}
public function getBlockPrefix(): string
{
return 'radio';
}
| setDefaults([
| {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/RadioType.php",
"language": "php",
"file_size": 796,
"cut_index": 524,
"middle_length": 14
} |
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\Extension\Core\Type;
use Symfony\Component\Form\Ab... | efaults([
'invalid_message' => 'Please choose a valid range.',
]);
}
public function getParent(): ?string
{
return TextType::class;
}
public function getBlockPrefix(): string
{
return 'range';
| resolver->setD | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/RangeType.php",
"language": "php",
"file_size": 791,
"cut_index": 514,
"middle_length": 14
} |
ge.
*
* (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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\... | ptions['second_options']['required'] = $options['required'];
if (!isset($options['options']['error_bubbling'])) {
$options['options']['error_bubbling'] = $options['error_bubbling'];
}
// children fields must always be | ype
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
// Overwrite required option for child fields
$options['first_options']['required'] = $options['required'];
$o | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/RepeatedType.php",
"language": "php",
"file_size": 2290,
"cut_index": 563,
"middle_length": 229
} |
/*
* 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\Extension\Core\Type;
use Symfony\Component\Form\Abstr... | aults([
'invalid_message' => 'Please enter a valid search term.',
]);
}
public function getParent(): ?string
{
return TextType::class;
}
public function getBlockPrefix(): string
{
return 'search | solver->setDef | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/SearchType.php",
"language": "php",
"file_size": 798,
"cut_index": 517,
"middle_length": 14
} |
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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType... | y $options): void
{
$view->vars['clicked'] = $form->isClicked();
if (!$options['validate']) {
$view->vars['attr']['formnovalidate'] = true;
}
}
public function configureOptions(OptionsResolver $resolver): v | **
* A submit button.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class SubmitType extends AbstractType implements SubmitButtonTypeInterface
{
public function buildView(FormView $view, FormInterface $form, arra | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/SubmitType.php",
"language": "php",
"file_size": 1303,
"cut_index": 524,
"middle_length": 229
} |
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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType... | 'invalid_message' => 'Please provide a valid phone number.',
]);
}
public function getParent(): ?string
{
return TextType::class;
}
public function getBlockPrefix(): string
{
return 'tel';
}
} | tDefaults([
| {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/TelType.php",
"language": "php",
"file_size": 795,
"cut_index": 524,
"middle_length": 14
} |
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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony... | when NULL is submitted
// This gives more control and thus helps preventing some issues
// with PHP 7 which allows type hinting strings in functions
// See https://github.com/symfony/symfony/issues/5906#issuecomment-203189375
| s DataTransformerInterface
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
// When empty_data is explicitly set to an empty string,
// a string should always be returned | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/TextType.php",
"language": "php",
"file_size": 1601,
"cut_index": 537,
"middle_length": 229
} |
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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony... | his);
}
public function buildView(FormView $view, FormInterface $form, array $options): void
{
$view->vars['pattern'] = null;
unset($view->vars['attr']['pattern']);
}
public function getParent(): ?string
{
| Form\Util\StringUtil;
class TextareaType extends AbstractType implements DataTransformerInterface
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->addViewTransformer($t | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/TextareaType.php",
"language": "php",
"file_size": 1554,
"cut_index": 537,
"middle_length": 229
} |
\InvalidConfigurationException;
use Symfony\Component\Form\Exception\LogicException;
use Symfony\Component\Form\Extension\Core\DataTransformer\DatePointToDateTimeTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeImmutableToDateTimeTransformer;
use Symfony\Component\Form\Extension\Core\DataT... | use Symfony\Component\Form\ReversedTransformer;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
class TimeType extends AbstractType
{
private const WIDGETS = [
'text' => TextType::class,
| ToTimestampTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
| {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/TimeType.php",
"language": "php",
"file_size": 17105,
"cut_index": 921,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\ChoiceList\ChoiceList;
use Symfony\Component\Form\ChoiceList\... | lver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
class TimezoneType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
if ('datetimezone' === $options['input']) {
| ponent\Form\Extension\Core\DataTransformer\IntlTimeZoneToStringTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Intl\Intl;
use Symfony\Component\Intl\Timezones;
use Symfony\Component\OptionsReso | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php",
"language": "php",
"file_size": 4674,
"cut_index": 614,
"middle_length": 229
} |
/*
* 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\Extension\Core\Type;
use Symfony\Component\Form\Abstra... | e $translator = null,
) {
}
public function buildForm(FormBuilderInterface $builder, array $options): void
{
if (!isset($options['constraints'])) {
$builder->addEventSubscriber(new TransformationFailureListener($this->t | latorInterface;
/**
* @author Christian Flothmann <christian.flothmann@sensiolabs.de>
*/
class TransformationFailureExtension extends AbstractTypeExtension
{
public function __construct(
private ?TranslatorInterfac | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/TransformationFailureExtension.php",
"language": "php",
"file_size": 1137,
"cut_index": 518,
"middle_length": 229
} |
<?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\Extension\Core\Type;
use Symfony\Component\Form\... | ansformer(new UlidToStringTransformer())
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'compound' => false,
'invalid_message' => 'Please enter a valid U | esolver;
/**
* @author Pavel Dyakonov <wapinet@mail.ru>
*/
class UlidType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->addViewTr | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/UlidType.php",
"language": "php",
"file_size": 1024,
"cut_index": 512,
"middle_length": 229
} |
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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony... | tocol']) {
$builder->addEventSubscriber(new FixUrlProtocolListener($options['default_protocol']));
}
}
public function buildView(FormView $view, FormInterface $form, array $options): void
{
if ($options['default_pro | iew;
use Symfony\Component\OptionsResolver\OptionsResolver;
class UrlType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
if (null !== $options['default_pro | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/UrlType.php",
"language": "php",
"file_size": 1620,
"cut_index": 537,
"middle_length": 229
} |
<?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\Extension\Core\Type;
use Symfony\Component\Form\... | ansformer(new UuidToStringTransformer())
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'compound' => false,
'invalid_message' => 'Please enter a valid U | esolver;
/**
* @author Pavel Dyakonov <wapinet@mail.ru>
*/
class UuidType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->addViewTr | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/UuidType.php",
"language": "php",
"file_size": 1024,
"cut_index": 512,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\ChoiceList\ChoiceList;
use Symfony\Component\Form\ChoiceList\... | esolver $resolver): void
{
$resolver->setDefaults([
'choice_loader' => function (Options $options) {
if (!class_exists(Intl::class)) {
throw new LogicException(\sprintf('The "symfony/intl" compone | ver\Exception\InvalidOptionsException;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CurrencyType extends AbstractType
{
public function configureOptions(OptionsR | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php",
"language": "php",
"file_size": 4429,
"cut_index": 614,
"middle_length": 229
} |
orm\Extension\Core\DataTransformer\DateTimeToStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormInterface... | const ACCEPTED_FORMATS = [
\IntlDateFormatter::FULL,
\IntlDateFormatter::LONG,
\IntlDateFormatter::MEDIUM,
\IntlDateFormatter::SHORT,
];
private const WIDGETS = [
'text' => TextType::class,
'choice' | olver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
class DateType extends AbstractType
{
public const DEFAULT_FORMAT = \IntlDateFormatter::MEDIUM;
public const HTML5_FORMAT = 'yyyy-MM-dd';
private | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/DateType.php",
"language": "php",
"file_size": 17952,
"cut_index": 1331,
"middle_length": 229
} |
ge.
*
* (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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver... | pes('class', 'string')
->setAllowedValues('class', enum_exists(...))
->setDefault('choices', static fn (Options $options): array => $options['class']::cases())
->setDefault('choice_label', static function (Options $optio | Turek <me@derrabus.de>
*/
final class EnumType extends AbstractType
{
public function configureOptions(OptionsResolver $resolver): void
{
$resolver
->setRequired(['class'])
->setAllowedTy | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/EnumType.php",
"language": "php",
"file_size": 2119,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Event\PreSubmitEvent;
use Symfony\Component\Form\FileUploadError;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfon... | 76;
private const SUFFIXES = [
1 => 'bytes',
self::KIB_BYTES => 'KiB',
self::MIB_BYTES => 'MiB',
];
public function __construct(
private ?TranslatorInterface $translator = null,
) {
}
public functi | r\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Contracts\Translation\TranslatorInterface;
class FileType extends AbstractType
{
public const KIB_BYTES = 1024;
public const MIB_BYTES = 10485 | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/FileType.php",
"language": "php",
"file_size": 7971,
"cut_index": 716,
"middle_length": 229
} |
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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony... | ewTransformer(new IntegerToLocalizedStringTransformer($options['grouping'], $options['rounding_mode'], !$options['grouping'] ? 'en' : null));
}
public function buildView(FormView $view, FormInterface $form, array $options): void
{
if ( | nent\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
class IntegerType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->addVi | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/IntegerType.php",
"language": "php",
"file_size": 1967,
"cut_index": 537,
"middle_length": 229
} |
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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony... | solver $resolver): void
{
$resolver->setDefaults([
'choice_loader' => function (Options $options) {
if (!class_exists(Intl::class)) {
throw new LogicException(\sprintf('The "symfony/intl" componen | tl;
use Symfony\Component\Intl\Locales;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
class LocaleType extends AbstractType
{
public function configureOptions(OptionsRe | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php",
"language": "php",
"file_size": 1851,
"cut_index": 537,
"middle_length": 229
} |
?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\Extension\Validator\Type;
use Symfony\Component\F... | he first field
$errorMapping = static fn (Options $options) => ['.' => $options['first_name']];
$resolver->setDefaults([
'error_mapping' => $errorMapping,
]);
}
public static function getExtendedTypes(): iterab | **
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class RepeatedTypeValidatorExtension extends AbstractTypeExtension
{
public function configureOptions(OptionsResolver $resolver): void
{
// Map errors to t | {
"filepath": "src/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php",
"language": "php",
"file_size": 1053,
"cut_index": 513,
"middle_length": 229
} |
ge.
*
* (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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\ChoiceList... |
{
$resolver->setDefaults([
'choice_loader' => function (Options $options) {
if (!class_exists(Intl::class)) {
throw new LogicException(\sprintf('The "symfony/intl" component is required to use "% | nent\Intl\Intl;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CountryType extends AbstractType
{
public function configureOptions(OptionsResolver $resolver): void | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/CountryType.php",
"language": "php",
"file_size": 2064,
"cut_index": 563,
"middle_length": 229
} |
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\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransforme... | formerInterface
{
/**
* @param string $trueValue The value emitted upon transform if the input is true
*/
public function __construct(
private string $trueValue,
private array $falseValues = [null],
) {
if (\in | .
*
* @author Bernhard Schussek <bschussek@gmail.com>
* @author Florian Eckerstorfer <florian@eckerstorfer.org>
*
* @implements DataTransformerInterface<bool, string>
*/
class BooleanToStringTransformer implements DataTrans | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php",
"language": "php",
"file_size": 1816,
"cut_index": 537,
"middle_length": 229
} |
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\Extension\Core\DataTransformer;
use Symfony\Component\Form\ChoiceList\Cho... |
public function transform(mixed $choice): mixed
{
return (string) current($this->choiceList->getValuesForChoices([$choice]));
}
public function reverseTransform(mixed $value): mixed
{
if (null !== $value && !\is_strin | m>
*
* @implements DataTransformerInterface<mixed, string>
*/
class ChoiceToValueTransformer implements DataTransformerInterface
{
public function __construct(
private ChoiceListInterface $choiceList,
) {
} | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php",
"language": "php",
"file_size": 1518,
"cut_index": 537,
"middle_length": 229
} |
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\Extension\Core\DataTransformer;
use Symfony\Component\Form\ChoiceList\Cho... | }
public function transform(mixed $array): array
{
if (null === $array) {
return [];
}
if (!\is_array($array)) {
throw new TransformationFailedException('Expected an array.');
}
ret | m>
*
* @implements DataTransformerInterface<array, array>
*/
class ChoicesToValuesTransformer implements DataTransformerInterface
{
public function __construct(
private ChoiceListInterface $choiceList,
) {
| {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php",
"language": "php",
"file_size": 1607,
"cut_index": 537,
"middle_length": 229
} |
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\Extension\Core\DataTransformer;
use Symfony\Component\Form\D... | ) {
}
public function transform(mixed $value): mixed
{
foreach ($this->transformers as $transformer) {
$value = $transformer->transform($value);
}
return $value;
}
public function reverseTransfo | rmerInterface
{
/**
* Uses the given value transformers to transform values.
*
* @param DataTransformerInterface[] $transformers
*/
public function __construct(
protected array $transformers,
| {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php",
"language": "php",
"file_size": 1373,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**
* Transforms between a normaliz... | inutes';
public const SECONDS = 'seconds';
public const INVERT = 'invert';
private const AVAILABLE_FIELDS = [
self::YEARS => 'y',
self::MONTHS => 'm',
self::DAYS => 'd',
self::HOURS => 'h',
self::MINUTES | ntervalToArrayTransformer implements DataTransformerInterface
{
public const YEARS = 'years';
public const MONTHS = 'months';
public const DAYS = 'days';
public const HOURS = 'hours';
public const MINUTES = 'm | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php",
"language": "php",
"file_size": 5598,
"cut_index": 716,
"middle_length": 229
} |
ge.
*
* (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\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Co... | a \DateInterval instance to a string.
*
* @see \DateInterval::format() for supported formats
*
* @param string $format The date format
*/
public function __construct(
private string $format = 'P%yY%mM%dDT%hH%iM%sS',
| uthor Steffen Roßkamp <steffen.rosskamp@gimmickmedia.de>
*
* @implements DataTransformerInterface<\DateInterval, string>
*/
class DateIntervalToStringTransformer implements DataTransformerInterface
{
/**
* Transforms | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php",
"language": "php",
"file_size": 2647,
"cut_index": 563,
"middle_length": 229
} |
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\Extension\Core\DataTransformer;
use Symfony\Component\Clock\... | if (null === $value) {
return null;
}
if (!$value instanceof DatePoint) {
throw new TransformationFailedException(\sprintf('Expected a "%s".', DatePoint::class));
}
return \DateTime::createFromImmut | object.
*
* @implements DataTransformerInterface<DatePoint, \DateTime>
*/
final class DatePointToDateTimeTransformer implements DataTransformerInterface
{
public function transform(mixed $value): ?\DateTime
{
| {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/DatePointToDateTimeTransformer.php",
"language": "php",
"file_size": 1360,
"cut_index": 524,
"middle_length": 229
} |
ge.
*
* (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\Extension\Validator\ViolationMapper;
use Symfony\Component\Form\Exception\ErrorMappingException;
us... | rule path.
*
* If the rule matches, the form mapped by the rule is returned.
* Otherwise this method returns false.
*/
public function match(string $propertyPath): ?FormInterface
{
return $propertyPath === $this->proper | private string $propertyPath,
private string $targetPath,
) {
}
public function getOrigin(): FormInterface
{
return $this->origin;
}
/**
* Matches a property path against the | {
"filepath": "src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php",
"language": "php",
"file_size": 2078,
"cut_index": 563,
"middle_length": 229
} |
*
* 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\Extension\Validator\ViolationMapper;
use Symfony\Compone... | nder
* the given form.
*
* @param bool $allowNonSynchronized Whether to allow mapping to non-synchronized forms
*/
public function mapViolation(ConstraintViolation $violation, FormInterface $form, bool $allowNonSynchronized = false) | a constraint violation to a form in the form tree u | {
"filepath": "src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapperInterface.php",
"language": "php",
"file_size": 838,
"cut_index": 520,
"middle_length": 52
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core;
use Symfony\Component\Form\AbstractExtension;
use Symfony\Component\Form\ChoiceList\Factory\CachingFactoryDecorator;
use Symfony\Compo... | erface;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Represents the main form extension, which loads the core functionality.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class CoreExtension extends AbstractExtension
{
pri | orator;
use Symfony\Component\Form\Extension\Core\Type\TransformationFailureExtension;
use Symfony\Component\Form\Flow;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\PropertyAccess\PropertyAccessorInt | {
"filepath": "src/Symfony/Component/Form/Extension/Core/CoreExtension.php",
"language": "php",
"file_size": 3570,
"cut_index": 614,
"middle_length": 229
} |
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\Extension\Core\DataAccessor;
use Symfony\Component\Form\DataAccessorInter... | getConfig()->getOption('getter')) {
throw new AccessException('Unable to read from the given form data as no getter is defined.');
}
return ($getter)($data, $form);
}
public function setValue(object|array &$data, mixed | @author Yonel Ceruto <yonelceruto@gmail.com>
*/
class CallbackAccessor implements DataAccessorInterface
{
public function getValue(object|array $data, FormInterface $form): mixed
{
if (null === $getter = $form-> | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataAccessor/CallbackAccessor.php",
"language": "php",
"file_size": 1619,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractRendererEngine;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Exception\LogicException;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterf... | ss BaseType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->setDisabled($options['disabled']);
$builder->setAutoInitialize($options['auto_initialize']);
}
pu | oes not appear in the form's type inheritance chain and as such
* cannot be extended (via {@link \Symfony\Component\Form\FormExtensionInterface}) nor themed.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
abstract cla | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/BaseType.php",
"language": "php",
"file_size": 6440,
"cut_index": 716,
"middle_length": 229
} |
he 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\Extension\Core\Type;
use Symfony\Component\Form\ButtonTypeInterface;
use Symfony\Co... | return null;
}
public function getBlockPrefix(): string
{
return 'button';
}
public function configureOptions(OptionsResolver $resolver): void
{
parent::configureOptions($resolver);
$resolver->setDefault(' | public function getParent(): ?string
{
| {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/ButtonType.php",
"language": "php",
"file_size": 889,
"cut_index": 547,
"middle_length": 52
} |
ponent\Form\ChoiceList\Factory\Cache\ChoiceValue;
use Symfony\Component\Form\ChoiceList\Factory\Cache\GroupBy;
use Symfony\Component\Form\ChoiceList\Factory\Cache\PreferredChoice;
use Symfony\Component\Form\ChoiceList\Factory\CachingFactoryDecorator;
use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterf... | orm\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\Event\PreSubmitEvent;
use Symfony\Component\Form\Exception\LogicException;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Extension\Core\DataMapper\C | \ChoiceLoaderInterface;
use Symfony\Component\Form\ChoiceList\Loader\LazyChoiceLoader;
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
use Symfony\Component\Form\ChoiceList\View\ChoiceListView;
use Symfony\Component\F | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php",
"language": "php",
"file_size": 22664,
"cut_index": 1331,
"middle_length": 229
} |
ge.
*
* (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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilde... | /i';
public function __construct(
private ?TranslatorInterface $translator = null,
) {
}
public function buildForm(FormBuilderInterface $builder, array $options): void
{
if (!$options['html5']) {
return;
| y\Contracts\Translation\TranslatorInterface;
class ColorType extends AbstractType
{
/**
* @see https://www.w3.org/TR/html52/sec-forms.html#color-state-typecolor
*/
private const HTML5_PATTERN = '/^#[0-9a-f]{6}$ | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/ColorType.php",
"language": "php",
"file_size": 2368,
"cut_index": 563,
"middle_length": 229
} |
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\Extension\Core\EventListener;
use Symfony\Component\EventDis... | ta
*/
public function __construct(
private ?string $defaultProtocol = 'http',
) {
}
public function onSubmit(FormEvent $event): void
{
$data = $event->getData();
if ($this->defaultProtocol && $data && \is_ | rnhard Schussek <bschussek@gmail.com>
*/
class FixUrlProtocolListener implements EventSubscriberInterface
{
/**
* @param string|null $defaultProtocol The URL scheme to add when there is none or null to not modify the da | {
"filepath": "src/Symfony/Component/Form/Extension/Core/EventListener/FixUrlProtocolListener.php",
"language": "php",
"file_size": 1290,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\Event\PostSetDataEvent;
use Symfony\Component\Form\Event\PreSetDataEvent;
use Symfony\Component\Form\Exception\UnexpectedTypeExcept... | ay $preSetDataChildrenStack = [];
public function __construct(
private string $type,
private array $options = [],
private bool $allowAdd = false,
private bool $allowDelete = false,
bool|callable $deleteEmpty = f | the client.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class ResizeFormListener implements EventSubscriberInterface
{
protected array $prototypeOptions;
private \Closure|bool $deleteEmpty;
private arr | {
"filepath": "src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php",
"language": "php",
"file_size": 6741,
"cut_index": 716,
"middle_length": 229
} |
n 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\Extension\Core\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Fo... | ublic function preSubmit(FormEvent $event): void
{
$data = $event->getData();
if (!\is_string($data)) {
return;
}
$event->setData(StringUtil::trim($data));
}
public static function getSubscribedEve | Listener implements EventSubscriberInterface
{
p | {
"filepath": "src/Symfony/Component/Form/Extension/Core/EventListener/TrimListener.php",
"language": "php",
"file_size": 973,
"cut_index": 582,
"middle_length": 52
} |
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\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransforme... | \IntlDateFormatter::MEDIUM,
\IntlDateFormatter::SHORT,
];
protected string $inputTimezone;
protected string $outputTimezone;
/**
* @param string|null $inputTimezone The name of the input timezone
* @param string|null |
*/
abstract class BaseDateTimeTransformer implements DataTransformerInterface
{
protected static array $formats = [
\IntlDateFormatter::NONE,
\IntlDateFormatter::FULL,
\IntlDateFormatter::LONG,
| {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php",
"language": "php",
"file_size": 1974,
"cut_index": 537,
"middle_length": 229
} |
fony\Component\Form\Extension\Core\DataTransformer\DateIntervalToArrayTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateIntervalToStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\IntegerToLocalizedStringTransformer;
use Symfony\Component\Form\FormBuilderInterface;
us... | weeks',
'days',
'hours',
'minutes',
'seconds',
];
private const WIDGETS = [
'text' => TextType::class,
'integer' => IntegerType::class,
'choice' => ChoiceType::class,
];
public functi | t\OptionsResolver\OptionsResolver;
/**
* @author Steffen Roßkamp <steffen.rosskamp@gimmickmedia.de>
*/
class DateIntervalType extends AbstractType
{
private const TIME_PARTS = [
'years',
'months',
' | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/DateIntervalType.php",
"language": "php",
"file_size": 10370,
"cut_index": 921,
"middle_length": 229
} |
/*
* 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\Extension\Core\Type;
use Symfony\Component\Form\Abstr... | ults([
'invalid_message' => 'Please enter a valid email address.',
]);
}
public function getParent(): ?string
{
return TextType::class;
}
public function getBlockPrefix(): string
{
return 'email | olver->setDefa | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/EmailType.php",
"language": "php",
"file_size": 798,
"cut_index": 517,
"middle_length": 14
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class HiddenType extends... | rs to the parent
'error_bubbling' => true,
'compound' => false,
'invalid_message' => 'The hidden field is invalid.',
]);
}
public function getBlockPrefix(): string
{
return 'hidden';
}
}
| 'required' => false,
// Pass erro | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/HiddenType.php",
"language": "php",
"file_size": 914,
"cut_index": 606,
"middle_length": 52
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Exception\LogicException;
use Symfony\Component\Form\Extension\Core\DataTransformer\MoneyToLocalizedStringTransformer;
use Symfony\Component\Form\Extension\Core\Da... | $options): void
{
// Values used in HTML5 number inputs should be formatted as in "1234.5", ie. 'en' format without grouping,
// according to https://www.w3.org/TR/html51/sec-forms.html#date-time-and-number-formats
$builder
| tionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
class MoneyType extends AbstractType
{
protected static array $patterns = [];
public function buildForm(FormBuilderInterface $builder, array | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php",
"language": "php",
"file_size": 5119,
"cut_index": 716,
"middle_length": 229
} |
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\Extension\Validator\EventListener;
use Symfony\Component\EventDispatcher\... | ubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [FormEvents::POST_SUBMIT => 'validateForm'];
}
public function __construct(
private ValidatorInterface $validator,
private ViolationM | Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Validator\Validator\ValidatorInterface;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class ValidationListener implements EventS | {
"filepath": "src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php",
"language": "php",
"file_size": 1787,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (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\Extension\Core\DataAccessor;
use Symfony\Component\Form\DataAccessorInterface;
use Symfony\Componen... | ed
{
foreach ($this->accessors as $accessor) {
if ($accessor->isReadable($data, $form)) {
return $accessor->getValue($data, $form);
}
}
throw new AccessException('Unable to read from the | /**
* @param DataAccessorInterface[]|iterable $accessors
*/
public function __construct(
private iterable $accessors,
) {
}
public function getValue(object|array $data, FormInterface $form): mix | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataAccessor/ChainAccessor.php",
"language": "php",
"file_size": 2114,
"cut_index": 563,
"middle_length": 229
} |
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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType... | ]);
$resolver->setAllowedTypes('years', 'array');
}
public function getParent(): ?string
{
return DateType::class;
}
public function getBlockPrefix(): string
{
return 'birthday';
}
public functio | nction configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'years' => range(date('Y') - 120, date('Y')),
'invalid_message' => 'Please enter a valid birthdate.',
| {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/BirthdayType.php",
"language": "php",
"file_size": 1334,
"cut_index": 524,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener;
use Symfony\... | dd'] && $options['prototype']) {
$resizePrototypeOptions = array_replace($options['entry_options'], $options['prototype_options']);
$prototypeOptions = array_replace([
'required' => $options['required'],
| Resolver\OptionsResolver;
class CollectionType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$resizePrototypeOptions = null;
if ($options['allow_a | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php",
"language": "php",
"file_size": 4597,
"cut_index": 614,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeExcep... | t(
private bool $allowAdd = false,
private bool $allowDelete = false,
) {
}
public static function getSubscribedEvents(): array
{
return [
FormEvents::SUBMIT => 'onSubmit',
];
}
public f | scriberInterface
{
/**
* @param bool $allowAdd Whether values might be added to the collection
* @param bool $allowDelete Whether values might be removed from the collection
*/
public function __construc | {
"filepath": "src/Symfony/Component/Form/Extension/Core/EventListener/MergeCollectionListener.php",
"language": "php",
"file_size": 3529,
"cut_index": 614,
"middle_length": 229
} |
ge.
*
* (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\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Co... | throw new TransformationFailedException('Expected an array.');
}
$result = [];
foreach ($this->partMapping as $partKey => $originalKeys) {
if (!$array) {
$result[$partKey] = null;
| nsformer implements DataTransformerInterface
{
public function __construct(
private array $partMapping,
) {
}
public function transform(mixed $array): mixed
{
if (!\is_array($array ??= [])) {
| {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php",
"language": "php",
"file_size": 2240,
"cut_index": 563,
"middle_length": 229
} |
\LogicException;
use Symfony\Component\Form\Extension\Core\DataTransformer\ArrayToPartsTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DataTransformerChain;
use Symfony\Component\Form\Extension\Core\DataTransformer\DatePointToDateTimeTransformer;
use Symfony\Component\Form\Extension\Core\DataTran... | ymfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormInterface;
use | DateTimeToHtml5LocalDateTimeTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
use S | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php",
"language": "php",
"file_size": 14969,
"cut_index": 921,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\ChoiceList\ChoiceList;
use Symfony\Component\Form\ChoiceList\... | solver): void
{
$resolver->setDefaults([
'choice_loader' => function (Options $options) {
if (!class_exists(Intl::class)) {
throw new LogicException(\sprintf('The "symfony/intl" component is requi | y\Component\Intl\Languages;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
class LanguageType extends AbstractType
{
public function configureOptions(OptionsResolver $re | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php",
"language": "php",
"file_size": 3636,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Extension\Validator\ViolationMapper;
use Symfony\Component\Form\Exception\OutOfBoundsException;
use Symfony\Component\PropertyAccess\PropertyPath;
use Symfony\Component\PropertyAccess\PropertyPathInterface;
/**
* @author Bernhard Schussek <bschussek@... | ring $violationPath The property path of a {@link \Symfony\Component\Validator\ConstraintViolation} object
*/
public function __construct(string $violationPath)
{
$path = new PropertyPath($violationPath);
$elements = $path->get | ents = [];
private array $isIndex = [];
private array $mapsForm = [];
private string $pathAsString = '';
private int $length = 0;
/**
* Creates a new violation path from a string.
*
* @param st | {
"filepath": "src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php",
"language": "php",
"file_size": 6539,
"cut_index": 716,
"middle_length": 229
} |
ge.
*
* (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\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\... | by default, it
// needs to be a Boolean here. setData(null) is not acceptable
// for checkboxes and radio buttons (unless a custom model
// transformer handles this case).
// We cannot solve this case via overriding the "dat | ponent\OptionsResolver\OptionsResolver;
class CheckboxType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
// Unlike in other types, where the data is NULL | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php",
"language": "php",
"file_size": 2212,
"cut_index": 563,
"middle_length": 229
} |
ge.
*
* (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\Extension\Core\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use S... | public static function getSubscribedEvents(): array
{
return [
FormEvents::POST_SUBMIT => ['convertTransformationFailureToFormError', -1024],
];
}
public function convertTransformationFailureToFormError(FormEvent | lothmann <christian.flothmann@sensiolabs.de>
*/
class TransformationFailureListener implements EventSubscriberInterface
{
public function __construct(
private ?TranslatorInterface $translator = null,
) {
}
| {
"filepath": "src/Symfony/Component/Form/Extension/Core/EventListener/TransformationFailureListener.php",
"language": "php",
"file_size": 2108,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\Exception\LogicException;
use Symfony\Component\Form\Extension\Core\DataAccessor\CallbackAccessor;
use Symfony\Component\Form\Extension\Core\DataAccessor\ChainAccessor;
use Symfony\Component\Form\Extensio... | mponent\PropertyAccess\PropertyAccess;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Contracts\Translation\TranslatableInterface;
class FormType extends BaseType
{
private DataMapper $dataMapper;
public function __co | ponent\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Co | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/FormType.php",
"language": "php",
"file_size": 8364,
"cut_index": 716,
"middle_length": 229
} |
ent\Form\FormInterface;
use Symfony\Component\Form\FormRendererInterface;
use Symfony\Component\Form\Util\InheritDataAwareIterator;
use Symfony\Component\PropertyAccess\PropertyPathBuilder;
use Symfony\Component\PropertyAccess\PropertyPathIterator;
use Symfony\Component\PropertyAccess\PropertyPathIteratorInterface;
use... | private ?TranslatorInterface $translator = null,
) {
}
public function mapViolation(ConstraintViolation $violation, FormInterface $form, bool $allowNonSynchronized = false): void
{
$this->allowNonSynchronized = $allowNonSynchr | chussek@gmail.com>
*/
class ViolationMapper implements ViolationMapperInterface
{
private bool $allowNonSynchronized = false;
public function __construct(
private ?FormRendererInterface $formRenderer = null,
| {
"filepath": "src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php",
"language": "php",
"file_size": 12830,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Exception\LogicException;
use Symfony\Component\Form\Extension\Core\DataTransformer\WeekToArrayTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Sy... | erface $builder, array $options): void
{
if ('string' === $options['input']) {
$builder->addModelTransformer(new WeekToArrayTransformer());
}
if ('single_text' === $options['widget']) {
$builder->addView | tionsResolver\OptionsResolver;
class WeekType extends AbstractType
{
private const WIDGETS = [
'text' => IntegerType::class,
'choice' => ChoiceType::class,
];
public function buildForm(FormBuilderInt | {
"filepath": "src/Symfony/Component/Form/Extension/Core/Type/WeekType.php",
"language": "php",
"file_size": 6548,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\DataAccessor;
use Symfony\Component\Form\DataAccessorInterface;
use Symfony\Component\Form\DataMapperInterface;
use Symfony\Component\F... | itializedPropertyException;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyAccess\PropertyPathInterface;
/**
* Writes and reads values to/from an object o | xception as PropertyAccessException;
use Symfony\Component\PropertyAccess\Exception\NoSuchIndexException;
use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
use Symfony\Component\PropertyAccess\Exception\Unin | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataAccessor/PropertyPathAccessor.php",
"language": "php",
"file_size": 4442,
"cut_index": 614,
"middle_length": 229
} |
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\Extension\Core\DataTransformer;
use Symfony\Component\Form\DataTransforme... | ll === $value) {
return null;
}
if (!$value instanceof Uuid) {
throw new TransformationFailedException('Expected a Uuid.');
}
return (string) $value;
}
public function reverseTransform(mixe | Dyakonov <wapinet@mail.ru>
*
* @implements DataTransformerInterface<Uuid, string>
*/
class UuidToStringTransformer implements DataTransformerInterface
{
public function transform(mixed $value): ?string
{
if (nu | {
"filepath": "src/Symfony/Component/Form/Extension/Core/DataTransformer/UuidToStringTransformer.php",
"language": "php",
"file_size": 1664,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Console\Descriptor;
use Symfony\Component\Console\Descriptor\DescriptorInterface;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\OutputStyle;
use Symfony\Compone... | act class Descriptor implements DescriptorInterface
{
protected OutputStyle $output;
protected array $ownOptions = [];
protected array $overriddenOptions = [];
protected array $parentOptions = [];
protected array $extensionOptions = []; | ResolverIntrospector;
use Symfony\Component\OptionsResolver\Exception\NoConfigurationException;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* @author Yonel Ceruto <yonelceruto@gmail.com>
*
* @internal
*/
abstr | {
"filepath": "src/Symfony/Component/Form/Console/Descriptor/Descriptor.php",
"language": "php",
"file_size": 8090,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Console\Descriptor;
use Symfony\Component\Form\ResolvedFormTypeInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* @author Yonel... | uessers'] = $options['guessers'];
}
$this->writeData($data, $options);
}
protected function describeResolvedFormType(ResolvedFormTypeInterface $resolvedFormType, array $options = []): void
{
$this->collectOptions($reso | pes'] = $options['core_types'];
$data['service_form_types'] = $options['service_types'];
if (!$options['show_deprecated']) {
$data['type_extensions'] = $options['extensions'];
$data['type_g | {
"filepath": "src/Symfony/Component/Form/Console/Descriptor/JsonDescriptor.php",
"language": "php",
"file_size": 4346,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\Console\Descriptor;
use Symfony\Component\Console\Helper\Dumper;
use Symfony\Component\Console\Helper\TableSeparator;
use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter;
use Symfony\Component\Form\ResolvedFormTypeInterface;
use Symfony\... | ilt-in form types (Symfony\Component\Form\Extension\Core\Type)');
$shortClassNames = array_map(fn ($fqcn) => $this->formatClassLink($fqcn, \array_slice(explode('\\', $fqcn), -1)[0]), $options['core_types']);
for ($i = 0, $loopsMax = | private readonly ?FileLinkFormatter $fileLinkFormatter = null,
) {
}
protected function describeDefaults(array $options): void
{
if ($options['core_types']) {
$this->output->section('Bu | {
"filepath": "src/Symfony/Component/Form/Console/Descriptor/TextDescriptor.php",
"language": "php",
"file_size": 7861,
"cut_index": 716,
"middle_length": 229
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Console\Helper;
use Symfony\Component\Console\Helper\DescriptorHelper as BaseDescriptorHelper;
use Symfony\Component\ErrorHandler\ErrorRendere... | ends BaseDescriptorHelper
{
public function __construct(?FileLinkFormatter $fileLinkFormatter = null)
{
$this
->register('txt', new TextDescriptor($fileLinkFormatter))
->register('json', new JsonDescriptor())
| .com>
*
* @internal
*/
class DescriptorHelper ext | {
"filepath": "src/Symfony/Component/Form/Console/Helper/DescriptorHelper.php",
"language": "php",
"file_size": 925,
"cut_index": 606,
"middle_length": 52
} |
buted with this source code.
*/
namespace Symfony\Component\Form\ChoiceList;
/**
* A list of choices with arbitrary data types.
*
* The user of this class is responsible for assigning string values to the
* choices and for their uniqueness.
* Both the choices and their values are passed to the constructor.
* E... | iginalKeys;
protected ?\Closure $valueCallback = null;
/**
* Creates a list with the given choices and values.
*
* The given choice array must have the same array keys as the value array.
*
* @param iterable $choices | rface
{
protected array $choices;
/**
* The values indexed by the original keys.
*/
protected array $structuredValues;
/**
* The original keys of the choices array.
*/
protected array $or | {
"filepath": "src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php",
"language": "php",
"file_size": 6586,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Form\ChoiceList;
use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceAttr;
use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceFieldName;
use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceFilter;
use Symfony\Component\Form\ChoiceList\Fac... | oiceLoader;
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
use Symfony\Component\Form\FormTypeExtensionInterface;
use Symfony\Component\Form\FormTypeInterface;
/**
* A set of convenient static methods to create cacheable choice list | \Form\ChoiceList\Factory\Cache\ChoiceValue;
use Symfony\Component\Form\ChoiceList\Factory\Cache\GroupBy;
use Symfony\Component\Form\ChoiceList\Factory\Cache\PreferredChoice;
use Symfony\Component\Form\ChoiceList\Loader\CallbackCh | {
"filepath": "src/Symfony/Component/Form/ChoiceList/ChoiceList.php",
"language": "php",
"file_size": 6613,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\ChoiceList;
/**
* A list of choices that can be selected in a choice field.
*
* A choice list assigns unique string values to each of a list of cho... | turn array The selectable choices indexed by the corresponding values
*/
public function getChoices(): array;
/**
* Returns the values for the choices.
*
* The values are strings that do not contain duplicates:
*
* | * Values must always be strings and (within the list) free of duplicates.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface ChoiceListInterface
{
/**
* Returns all selectable choices.
*
* @re | {
"filepath": "src/Symfony/Component/Form/ChoiceList/ChoiceListInterface.php",
"language": "php",
"file_size": 4511,
"cut_index": 614,
"middle_length": 229
} |
ge.
*
* (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\ChoiceList;
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
/**
* A choice li... | lass LazyChoiceList implements ChoiceListInterface
{
/**
* The callable creating string values for each choice.
*
* If null, choices are cast to strings.
*/
private ?\Closure $value;
/**
* Creates a lazily-loaded list | called, the choice list is only loaded partially for improved performance.
*
* Once {@link getChoices()} or {@link getValues()} is called, the list is
* loaded fully.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
c | {
"filepath": "src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php",
"language": "php",
"file_size": 2457,
"cut_index": 563,
"middle_length": 229
} |
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\ChoiceList\Loader;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;... | }
public function loadChoicesForValues(array $values, ?callable $value = null): array
{
if (!$values) {
return [];
}
return $this->doLoadChoicesForValues($values, $value);
}
/**
* @param-immedi | vate ?iterable $choices;
/**
* @final
*/
public function loadChoiceList(?callable $value = null): ChoiceListInterface
{
return new ArrayChoiceList($this->choices ??= $this->loadChoices(), $value);
| {
"filepath": "src/Symfony/Component/Form/ChoiceList/Loader/AbstractChoiceLoader.php",
"language": "php",
"file_size": 1832,
"cut_index": 537,
"middle_length": 229
} |
<?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\ChoiceList\Loader;
/**
* Loads an {@link ArrayC... | ack The callable returning iterable choices
*/
public function __construct(callable $callback)
{
$this->callback = $callback(...);
}
protected function loadChoices(): iterable
{
return ($this->callback)();
}
}
| re $callback;
/**
* @param callable $callb | {
"filepath": "src/Symfony/Component/Form/ChoiceList/Loader/CallbackChoiceLoader.php",
"language": "php",
"file_size": 820,
"cut_index": 512,
"middle_length": 52
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.