ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCertificateTemplateDeleteAction.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
27
28 public function __construct(
29 private readonly ilCertificateTemplateRepository $templateRepository,
30 private readonly string $iliasVersion = ILIAS_VERSION_NUMERIC,
32 ) {
33 if (null === $objectHelper) {
35 }
36 $this->objectHelper = $objectHelper;
37 }
38
39 public function delete(int $templateId, int $objectId): void
40 {
41 $template = $this->templateRepository->fetchCurrentlyUsedCertificate($objectId);
42
43 $this->templateRepository->deleteTemplate($templateId, $objectId);
44
45 $version = $template->getVersion();
46 $certificateTemplate = new ilCertificateTemplate(
47 $objectId,
48 $this->objectHelper->lookupType($objectId),
49 '',
50 hash('sha256', ''),
51 '',
52 $version + 1,
53 $this->iliasVersion,
54 time(),
55 false,
56 '',
57 '',
58 '',
59 '',
60 );
61
62 $this->templateRepository->save($certificateTemplate);
63 }
64}
$version
Definition: plugin.php:24
__construct(private readonly ilCertificateTemplateRepository $templateRepository, private readonly string $iliasVersion=ILIAS_VERSION_NUMERIC, ?ilCertificateObjectHelper $objectHelper=null)
const ILIAS_VERSION_NUMERIC