Files
iTop/lib/symfony/form/Exception/TransformationFailedException.php
Benjamin Dalsass 5dd450e9bf 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
2025-10-10 16:02:25 +02:00

56 lines
1.7 KiB
PHP

<?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;
}
}