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

heimrichhannot / contao-utils-bundle / 8111835828

01 Mar 2024 01:05PM UTC coverage: 23.14% (+0.02%) from 23.122%
8111835828

push

github

drprofesq
fix test

1291 of 5579 relevant lines covered (23.14%)

1.54 hits per line

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

14.29
/src/EventListener/DcaField/AbstractDcaFieldListener.php
1
<?php
2

3
namespace HeimrichHannot\UtilsBundle\EventListener\DcaField;
4

5
use Contao\CoreBundle\Framework\ContaoFramework;
6
use Contao\Model;
7
use Psr\Container\ContainerInterface;
8
use Symfony\Contracts\Service\ServiceSubscriberInterface;
9

10
abstract class AbstractDcaFieldListener implements ServiceSubscriberInterface
11
{
12
    /** @var ContainerInterface */
13
    protected $container;
14

15
    public function __construct(ContainerInterface $container)
16
    {
17
        $this->container = $container;
3✔
18
    }
19

20
    protected function getModelInstance(string $table, int $id): ?Model
21
    {
22
        $framework = $this->container->get('contao.framework');
×
23
        $modelClass = $framework->getAdapter(Model::class)->getClassFromTable($table);
×
24
        return $framework->getAdapter($modelClass)->findByPk($id);
×
25
    }
26

27
    public static function getSubscribedServices(): array
28
    {
29
        return [
×
30
            'contao.framework' => ContaoFramework::class,
×
31
        ];
×
32
    }
33
}
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

© 2025 Coveralls, Inc