Initial xentral_oss_20.3.c9ffacf
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Resubmission\Exception;
|
||||
|
||||
class InvalidArgumentException extends \InvalidArgumentException implements ResubmissionExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Resubmission\Exception;
|
||||
|
||||
use Xentral\Core\Exception\ModuleExceptionInterface;
|
||||
|
||||
interface ResubmissionExceptionInterface extends ModuleExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Resubmission\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class ResubmissionNotFoundException extends RuntimeException implements ResubmissionExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Resubmission\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class ResubmissionTaskNotFoundException extends RuntimeException implements ResubmissionExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Resubmission\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class StageNotFoundException extends RuntimeException implements ResubmissionExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Resubmission\Exception;
|
||||
|
||||
use DomainException;
|
||||
|
||||
class TaskMustBeCompletedException extends DomainException implements ResubmissionExceptionInterface
|
||||
{
|
||||
/** @var string $requiredStageName */
|
||||
private $requiredStageName;
|
||||
|
||||
/** @var string $currentStageName */
|
||||
private $currentStageName;
|
||||
|
||||
/**
|
||||
* Exception wird geworfen wenn eine Aufgabe als "offen" angelegt werden soll
|
||||
* und die aktuelle Stage und die Einstellung in "Pflichtfeld ab Stage" das nicht zulässt.
|
||||
*
|
||||
* @param string $requiredStageName
|
||||
* @param string $currentStageName
|
||||
*
|
||||
* @return TaskMustBeCompletedException
|
||||
*/
|
||||
public static function onCreation($requiredStageName, $currentStageName)
|
||||
{
|
||||
$instance = new self(sprintf(
|
||||
'The Task cannot be created. The task must be completed from stage "%s" on. ' .
|
||||
'The resubmission is currently in stage "%s".',
|
||||
$requiredStageName,
|
||||
$currentStageName
|
||||
));
|
||||
|
||||
$instance->requiredStageName = $requiredStageName;
|
||||
$instance->currentStageName = $currentStageName;
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exception wird geworfen wenn eine Aufgabe beim Bearbeiten auf "offen" angelegt werden soll
|
||||
* und die aktuelle Stage und die Einstellung in "Pflichtfeld ab Stage" das nicht zulässt.
|
||||
*
|
||||
* @param string $requiredStageName
|
||||
* @param string $currentStageName
|
||||
*
|
||||
* @return TaskMustBeCompletedException
|
||||
*/
|
||||
public static function onModification($requiredStageName, $currentStageName)
|
||||
{
|
||||
$instance = new self(sprintf(
|
||||
'The Task modification is invalid. The task must be completed from stage "%s" on. ' .
|
||||
'The resubmission is currently in stage "%s".',
|
||||
$requiredStageName,
|
||||
$currentStageName
|
||||
));
|
||||
|
||||
$instance->requiredStageName = $requiredStageName;
|
||||
$instance->currentStageName = $currentStageName;
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exception wird geworfen wenn eine abgeschlossene Aufgabe zurück auf "offen" gestellt werden soll
|
||||
* und die aktuelle Stage und die Einstellung in "Pflichtfeld ab Stage" das nicht zulässt.
|
||||
*
|
||||
* @param $requiredStageName
|
||||
* @param $currentStageName
|
||||
*
|
||||
* @return TaskMustBeCompletedException
|
||||
*/
|
||||
public static function onChangingStateToOpen($requiredStageName, $currentStageName)
|
||||
{
|
||||
$instance = new self(sprintf(
|
||||
'The Task cannot be changed to "open". The task needs to be completed from stage "%s" on. ' .
|
||||
'The resubmission is currently in stage "%s".',
|
||||
$requiredStageName,
|
||||
$currentStageName
|
||||
));
|
||||
|
||||
$instance->requiredStageName = $requiredStageName;
|
||||
$instance->currentStageName = $currentStageName;
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRequiredStageName()
|
||||
{
|
||||
return $this->requiredStageName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrentStageName()
|
||||
{
|
||||
return $this->currentStageName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Resubmission\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class TaskTemplateNotFoundException extends RuntimeException implements ResubmissionExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Resubmission\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
class TextFieldConfigNotFoundException extends RuntimeException implements ResubmissionExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Modules\Resubmission\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
final class ValidationFailedException extends RuntimeException implements ResubmissionExceptionInterface
|
||||
{
|
||||
/** @var array $errors */
|
||||
private $errors = [];
|
||||
|
||||
/**
|
||||
* @param array $errors
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function fromErrors(array $errors)
|
||||
{
|
||||
$errorString = '';
|
||||
foreach ($errors as $propertyName => $propertyErrors) {
|
||||
$errorString .= implode("\r\n", $propertyErrors);
|
||||
}
|
||||
|
||||
$exception = new self('Validation failed with following errors: ' . "\n\n" . $errorString);
|
||||
$exception->errors = $errors;
|
||||
|
||||
return $exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Modules\Resubmission\Exception;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
final class ViewNotFoundException extends RuntimeException implements ResubmissionExceptionInterface
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user