Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tajine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adullact
PKI
Tajine
Merge requests
!40
Draft: Resolve "add "revoked", "expires soon", "expired" badges"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Draft: Resolve "add "revoked", "expires soon", "expired" badges"
103-add-revoked-expires-soon-expired-badges
into
main
Overview
0
Commits
5
Pipelines
10
Changes
1
Open
Fabrice Gangler
requested to merge
103-add-revoked-expires-soon-expired-badges
into
main
9 months ago
Overview
0
Commits
5
Pipelines
10
Changes
1
Expand
Closes
#103
0
0
Merge request reports
Viewing commit
f2c76c72
Prev
Next
Show latest version
1 file
+
32
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
f2c76c72
feat(cert badges): add a computed property "expiringSoon" to Certificate entity
· f2c76c72
Fabrice Gangler
authored
9 months ago
src/webapp/src/Entity/Certificate.php
+
32
−
0
Options
@@ -45,6 +45,11 @@ class Certificate
#[ORM\Column]
private
?bool
$expired
=
null
;
/**
* Computed from validTo
*/
private
?bool
$expiringSoon
=
null
;
// #[ORM\ManyToOne(inversedBy: 'certificates')]
#[ORM\ManyToOne()]
private
?CertificateAuthority
$authority
=
null
;
@@ -158,6 +163,33 @@ public function setRevoked(bool $revoked): self
return
$this
;
}
/**
* @TODO to be implemented
*/
public
function
isExpiringSoon
():
?bool
{
// if (is_null($this->expiringSoon)) {
// $numberOfDays = Certificate::NUMBER_OF_DAYS_WHEN_EXPIRY_IS_EXPECTED_SOON;
// $now = new \DateTimeImmutable();
// $dateExpiringSoon = $now->add(\DateInterval::createFromDateString("$numberOfDays day"));
// $expiringSoon = false;
// if ($now < $this->getValidTo() && $this->getValidTo() < $dateExpiringSoon) {
// $expiringSoon = true;
// }
// $this->setExpiringSoon($expiringSoon);
// }
// dump($this->expiringSoon);
$this
->
setExpiringSoon
(
false
);
return
$this
->
expiringSoon
;
}
public
function
setExpiringSoon
(
bool
$expiringSoon
):
self
{
$this
->
expiringSoon
=
$expiringSoon
;
return
$this
;
}
public
function
isExpired
():
?bool
{
if
(
$this
->
expired
===
false
&&
$this
->
getValidTo
()
<
(
new
\DateTimeImmutable
()))
{
Loading