stfalcon-studio / DoctrineRedisCacheBundle

Compare c49b490 ... +0 ... ed25aaf

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -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,12 +25,40 @@
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
     */
30 42
    public function load(array $configs, ContainerBuilder $container): void
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
}

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Complexity Coverage
Cache/PredisCache.php ø 100.00%
DependencyInjection/StfalconStudioDoctrineRedisCacheExtension.php ø 100.00%
Service/Migration/MigrationVersionService.php ø 100.00%
Project Totals (3 files) 24 100.00%
Loading