mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°8771 - Add Symfony form component to iTop core (#760)
- Add Symfony Form Component - Add Symfony CSRF security component - Add iTop default form template - Add Twig debug extension to Twig Environment - Add iTop abstract controller facility to get form builder - Add Twig filter to make trans an alias of dict_s filter
This commit is contained in:
55
lib/symfony/form/Exception/TransformationFailedException.php
Normal file
55
lib/symfony/form/Exception/TransformationFailedException.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Indicates a value transformation error.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class TransformationFailedException extends RuntimeException
|
||||
{
|
||||
private ?string $invalidMessage;
|
||||
private array $invalidMessageParameters;
|
||||
|
||||
public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null, ?string $invalidMessage = null, array $invalidMessageParameters = [])
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
|
||||
$this->setInvalidMessage($invalidMessage, $invalidMessageParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message that will be shown to the user.
|
||||
*
|
||||
* @param string|null $invalidMessage The message or message key
|
||||
* @param array $invalidMessageParameters Data to be passed into the translator
|
||||
*/
|
||||
public function setInvalidMessage(?string $invalidMessage = null, array $invalidMessageParameters = []): void
|
||||
{
|
||||
if (1 > \func_num_args()) {
|
||||
trigger_deprecation('symfony/form', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
|
||||
}
|
||||
$this->invalidMessage = $invalidMessage;
|
||||
$this->invalidMessageParameters = $invalidMessageParameters;
|
||||
}
|
||||
|
||||
public function getInvalidMessage(): ?string
|
||||
{
|
||||
return $this->invalidMessage;
|
||||
}
|
||||
|
||||
public function getInvalidMessageParameters(): array
|
||||
{
|
||||
return $this->invalidMessageParameters;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user