Release 2.0.9 (#3922)

* fix api definition
* include customer number in validation message
* fix doctrine deprecation, prepare for DBAL 4
* added DataSubscriberInterface to identify certain doctrine subscribers
This commit is contained in:
Kevin Papst
2023-03-14 23:51:49 +01:00
committed by GitHub
parent 8449eafcb6
commit 1a8c78944a
15 changed files with 50 additions and 75 deletions

View File

@@ -17,7 +17,7 @@ final class Customer extends Constraint
public const CUSTOMER_NUMBER_EXISTING = 'kimai-customer-00';
protected const ERROR_NAMES = [
self::CUSTOMER_NUMBER_EXISTING => 'This account number is already used.',
self::CUSTOMER_NUMBER_EXISTING => 'The account number %number% is already used.',
];
public string $message = 'This customer has invalid settings.';

View File

@@ -40,6 +40,7 @@ final class CustomerValidator extends ConstraintValidator
$tmp = $this->customerRepository->findOneBy(['number' => $number]);
if ($tmp !== null && $tmp->getId() !== $value->getId()) {
$this->context->buildViolation(Customer::getErrorName(Customer::CUSTOMER_NUMBER_EXISTING))
->setParameter('%number%', $number)
->atPath('number')
->setTranslationDomain('validators')
->setCode(Customer::CUSTOMER_NUMBER_EXISTING)