mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-26 06:30:29 +01:00
53 lines
1.2 KiB
PHP
53 lines
1.2 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace Xentral\Modules\Resubmission\Exception;
|
||
|
|
||
|
use DomainException;
|
||
|
|
||
|
class TextFieldRequiredException extends DomainException implements ResubmissionExceptionInterface
|
||
|
{
|
||
|
/** @var string $fieldLabel */
|
||
|
private $fieldLabel;
|
||
|
|
||
|
/** @var string $requiredStageName */
|
||
|
private $requiredStageName;
|
||
|
|
||
|
/**
|
||
|
* Exception wird geworfen wenn ein benötigtes Freitextfeld beim Speichern leer ist.
|
||
|
*
|
||
|
* @param string $fieldLabel
|
||
|
* @param string $requiredStageName
|
||
|
*
|
||
|
* @return TextFieldRequiredException
|
||
|
*/
|
||
|
public static function onEmpty($fieldLabel, $requiredStageName)
|
||
|
{
|
||
|
$instance = new self(sprintf(
|
||
|
'The text field "%s" can not be saved. The text field is required from stage "%s" on.',
|
||
|
$fieldLabel,
|
||
|
$requiredStageName
|
||
|
));
|
||
|
|
||
|
$instance->fieldLabel = $fieldLabel;
|
||
|
$instance->requiredStageName = $requiredStageName;
|
||
|
|
||
|
return $instance;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return string
|
||
|
*/
|
||
|
public function getFieldLabel()
|
||
|
{
|
||
|
return $this->fieldLabel;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return string
|
||
|
*/
|
||
|
public function getRequiredStageName()
|
||
|
{
|
||
|
return $this->requiredStageName;
|
||
|
}
|
||
|
}
|