This bundle provide a simple command to archive tokens, so you can keep your database clean as possible.
$ bin/console yokai:security-token:archive
The command is using the archivist service to perform the operation.
Note : The default implementation of the service is
Yokai\SecurityTokenBundle\Archive\DeleteArchivist
. This implementation just delete every outdated tokens, based on thekeepUntil
property.
Fist create a class that will contain your own logic and the associated service.
<?php
namespace App\Security\Token\Archivist;
use Yokai\SecurityTokenBundle\Archive\ArchivistInterface;
class AppArchivist implements ArchivistInterface
{
public function archive(string $purpose = null): int
{
// whatever you can imagine
return 0; // how much tokens were archived
}
}
Then you only need to tell this bundle that it should use your service instead of the default one.
# config/packages/yokai_security_token.yaml
yokai_security_token:
services:
archivist: App\Security\Token\Archivist\AppArchivist