Skip to content

Latest commit

 

History

History
54 lines (35 loc) · 1.26 KB

4-archive-command.md

File metadata and controls

54 lines (35 loc) · 1.26 KB

Archive command

Command usage

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 the keepUntil property.

Creating your own archivist

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

« UsageEvents »