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

heimrichhannot / contao-utils-bundle / 8099821218

29 Feb 2024 05:05PM UTC coverage: 22.978% (+0.3%) from 22.703%
8099821218

Pull #74

github

koertho
fixed tests
Pull Request #74: Add date added field

29 of 41 new or added lines in 5 files covered. (70.73%)

8 existing lines in 1 file now uncovered.

1281 of 5575 relevant lines covered (22.98%)

1.54 hits per line

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

0.0
/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
    /**
13
     * @var ContainerInterface
14
     */
15
    private $container;
16

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

24
    public static function getSubscribedServices()
25
    {
NEW
26
        return [
×
NEW
27
            'contao.framework' => ContaoFramework::class,
×
NEW
28
        ];
×
29
    }
30

31
    public function setContainer(ContainerInterface $container): ?ContainerInterface
32
    {
NEW
33
        $this->container = $container;
×
34
    }
35

36

37
}
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