stfalcon-studio / DoctrineRedisCacheBundle

@@ -12,6 +12,7 @@
Loading
12 12
13 13
namespace StfalconStudio\DoctrineRedisCacheBundle\DependencyInjection;
14 14
15 +
use Doctrine\Migrations\Finder\RecursiveRegexFinder;
15 16
use Symfony\Component\Config\FileLocator;
16 17
use Symfony\Component\DependencyInjection\ContainerBuilder;
17 18
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
@@ -24,6 +25,17 @@
Loading
24 25
 */
25 26
class StfalconStudioDoctrineRedisCacheExtension extends Extension
26 27
{
28 +
    /** @var RecursiveRegexFinder */
29 +
    private $migrationFinder;
30 +
31 +
    /**
32 +
     * Constructor.
33 +
     */
34 +
    public function __construct()
35 +
    {
36 +
        $this->migrationFinder = new RecursiveRegexFinder();
37 +
    }
38 +
27 39
    /**
28 40
     * {@inheritdoc}
29 41
     */
@@ -31,5 +43,22 @@
Loading
31 43
    {
32 44
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
33 45
        $loader->load('services.yaml');
46 +
47 +
        $container->setParameter('cache_prefix_seed', $this->getLastMigrationVersion($container->getParameter('doctrine_migrations.dir_name')));
48 +
    }
49 +
50 +
    /**
51 +
     * @param string $dir
52 +
     *
53 +
     * @return string
54 +
     */
55 +
    public function getLastMigrationVersion(string $dir): string
56 +
    {
57 +
        $migrations = $this->migrationFinder->findMigrations($dir);
58 +
59 +
        $versions = \array_keys($migrations);
60 +
        $latest = \end($versions);
61 +
62 +
        return false !== $latest ? (string) $latest : '0';
34 63
    }
35 64
}
Files Complexity Coverage
Cache/PredisCache.php 17 100.00%
DependencyInjection/StfalconStudioDoctrineRedisCacheExtension.php 4 100.00%
Service/Migration/MigrationVersionService.php 3 100.00%
Project Totals (3 files) 24 100.00%
71.8
7.3=.3
TRAVIS_OS_NAME=linux
70.8
7.3=.3
TRAVIS_OS_NAME=linux

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading