lamoda/cleaner

This package is abandoned and no longer maintained. No replacement package was suggested.

Library for clean old data from different storages

1.0.0 2021-08-11 11:29 UTC

This package is auto-updated.

Last update: 2023-06-11 15:20:54 UTC


README

Build Status Scrutinizer Code Quality Code Coverage Build Status

Library that provides classes to clear old data from different storages, firstly from databases.

Installation

  1. Install library with composer:
composer require lamoda/cleaner

Standalone usage

Example of DoctrineDBALCleaner usage, which relies on doctrine/dbal connection.

use Lamoda\Cleaner\DB\Config\DBCleanerConfigFactory;
use Lamoda\Cleaner\DB\DoctrineDBALCleaner;

$config = DBCleanerConfigFactory::create([
    'query' => "DELETE * FROM big_table WHERE created_at < NOW() - (:interval || ' days')::interval",
    'parameters' => [
        'interval' => 90,
    ],
]);

/** @var \Doctrine\DBAL\Connection $connection */
$connection = $entityManager->getConnection();

$cleaner = new DoctrineDBALCleaner($connection, $config);
$cleaner->clear();