mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-27 00:55:01 +00:00
Add cron job for removing expired stored objects
Introduced `RemoveExpiredStoredObjectCronJob` to automate the deletion of expired stored objects every 7 days. Enhanced associated tests and updated relevant interfaces and classes to support the new cron job functionality.
This commit is contained in:
@@ -33,6 +33,13 @@ class StoredObjectVersion implements TrackCreationInterface
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* The stored object associated with this version.
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, inversedBy: 'versions')]
|
||||
#[ORM\JoinColumn(name: 'stored_object_id', nullable: true)]
|
||||
private ?StoredObject $storedObject;
|
||||
|
||||
/**
|
||||
* filename of the version in the stored object.
|
||||
*/
|
||||
@@ -40,12 +47,7 @@ class StoredObjectVersion implements TrackCreationInterface
|
||||
private string $filename = '';
|
||||
|
||||
public function __construct(
|
||||
/**
|
||||
* The stored object associated with this version.
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, inversedBy: 'versions')]
|
||||
#[ORM\JoinColumn(name: 'stored_object_id', nullable: true)]
|
||||
private StoredObject $storedObject,
|
||||
StoredObject $storedObject,
|
||||
|
||||
/**
|
||||
* The incremental version.
|
||||
@@ -76,6 +78,7 @@ class StoredObjectVersion implements TrackCreationInterface
|
||||
private string $type = '',
|
||||
?string $filename = null,
|
||||
) {
|
||||
$this->storedObject = $storedObject;
|
||||
$this->filename = $filename ?? self::generateFilename($this);
|
||||
}
|
||||
|
||||
@@ -124,4 +127,12 @@ class StoredObjectVersion implements TrackCreationInterface
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal to be used by StoredObject::removeVersion
|
||||
*/
|
||||
public function resetStoredObject(): void
|
||||
{
|
||||
$this->storedObject = null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user