8
0
DataWizard/Application/Model/Exceptions/InputUnvalidException.php

53 Zeilen
1.4 KiB
PHP

<?php
/**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
2022-01-17 10:59:18 +01:00
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\DataWizard\Application\Model\Exceptions;
use D3\DataWizard\Application\Model\QueryBase;
use Exception;
use FormManager\Inputs\Input;
class InputUnvalidException extends DataWizardException
{
2024-03-04 13:57:10 +01:00
public QueryBase $task;
2021-07-14 23:04:33 +02:00
/**
* InputUnvalidException constructor.
* @param QueryBase $task
* @param Input $inputElement
* @param int $iCode
* @param Exception|null $previous
* @throws Exception
*/
2022-01-17 10:59:18 +01:00
public function __construct(QueryBase $task, Input $inputElement, $iCode = 0, Exception $previous = null)
{
$messages = [];
foreach ($inputElement->getError()->getIterator() as $item) {
$messages[] = $inputElement->label->innerHTML.' -> '.$item->getMessage();
}
$sMessage = implode(
' - ',
[
$task->getTitle(),
2022-01-17 10:59:18 +01:00
implode(', ', $messages),
]
);
2022-01-17 10:59:18 +01:00
parent::__construct($sMessage, $iCode, $previous);
$this->task = $task;
}
2022-01-17 10:59:18 +01:00
}