Skip to content

Commit

Permalink
pia/smartbooster/sandbox-gp#13 Add EntityCleanupCommand to delete cro…
Browse files Browse the repository at this point in the history
…n, clean api calls or other entity easily through a bundle configuration
  • Loading branch information
mathieu-ducrot committed Sep 24, 2024
1 parent 2f386a8 commit 2fe21a8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ CHANGELOG for 1.x
### Added
- `EntityCleanupCommand` to delete cron, clean api calls or other entity easily through the bundle configuration **entity_cleanup_command_configs**

### Changed
- `UpdatableInterface::getUpdatedAt` and `UpdatableInterface::setUpdatedAt` handle nullable datetime

## v1.12.0 - (2024-09-23)
### Added
- `ArchivableInterface` & trait
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/UpdatableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

interface UpdatableInterface
{
public function getUpdatedAt(): \DateTimeInterface;
public function getUpdatedAt(): ?\DateTimeInterface;

public function setUpdatedAt(\DateTimeInterface $updatedAt, bool $initIntegerFields = true): void;
public function setUpdatedAt(?\DateTimeInterface $updatedAt, bool $initIntegerFields = true): void;

public function getUpdatedAtMonth(): ?int;

Expand Down
8 changes: 4 additions & 4 deletions src/Entity/UpdatableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trait UpdatableTrait
* @ORM\Column(type="datetime", nullable=true)
*/
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
protected \DateTimeInterface $updatedAt;
protected ?\DateTimeInterface $updatedAt = null;

/**
* @ORM\Column(type="integer", nullable=true)
Expand All @@ -25,15 +25,15 @@ trait UpdatableTrait
#[ORM\Column(nullable: true)]
protected ?int $updatedAtYear = null;

public function getUpdatedAt(): \DateTimeInterface
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}

public function setUpdatedAt(\DateTimeInterface $updatedAt, bool $initIntegerFields = true): void
public function setUpdatedAt(?\DateTimeInterface $updatedAt, bool $initIntegerFields = true): void
{
$this->updatedAt = $updatedAt;
if ($initIntegerFields) {
if ($updatedAt !== null && $initIntegerFields) {
$this->updatedAtMonth = (int) $updatedAt->format('m');
$this->updatedAtYear = (int) $updatedAt->format('Y');
}
Expand Down

0 comments on commit 2fe21a8

Please sign in to comment.