• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

valksor / php-doctrine-tools / 19113733249

05 Nov 2025 11:28AM UTC coverage: 23.881%. Remained the same
19113733249

push

github

k0d3r1s
code cleanup

0 of 1 new or added line in 1 file covered. (0.0%)

48 of 201 relevant lines covered (23.88%)

0.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/EventSubscriber/FixDefaultSchemaListener.php
1
<?php declare(strict_types = 1);
2

3
/*
4
 * This file is part of the Valksor package.
5
 *
6
 * (c) Davis Zalitis (k0d3r1s)
7
 * (c) SIA Valksor <packages@valksor.com>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12

13
namespace Valksor\Component\DoctrineTools\EventSubscriber;
14

15
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener;
16
use Doctrine\DBAL\Exception;
17
use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
18
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
19
use Doctrine\ORM\Tools\ToolEvents;
20

21
#[AsDoctrineListener(event: ToolEvents::postGenerateSchema)]
22
class FixDefaultSchemaListener
23
{
24
    /**
25
     * @throws Exception
26
     */
27
    public function postGenerateSchema(
28
        GenerateSchemaEventArgs $args,
29
    ): void {
30
        $schemaManager = $args->getEntityManager()
×
31
            ->getConnection()
×
32
            ->createSchemaManager();
×
33

34
        if (!$schemaManager instanceof PostgreSQLSchemaManager) {
×
35
            return;
×
36
        }
37

38
        foreach ($schemaManager->listSchemaNames() as $namespace) {
×
NEW
39
            if ('public' !== $namespace && !$args->getSchema()->hasNamespace($namespace)) {
×
40
                $args->getSchema()->createNamespace($namespace);
×
41
            }
42
        }
43
    }
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc