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

drago-ex / generator / 20458959257

23 Dec 2025 11:02AM UTC coverage: 84.0%. Remained the same
20458959257

push

github

web-flow
Update DataClassCommand.php

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

189 of 225 relevant lines covered (84.0%)

1.68 hits per line

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

50.0
/src/Drago/Generator/Command/DataClassCommand.php
1
<?php
2

3
/**
4
 * Drago Extension
5
 * Package built on Nette Framework
6
 */
7

8
declare(strict_types=1);
9

10
namespace Drago\Generator\Command;
11

12
use Drago\Generator\Generator\DataClassGenerator;
13
use Symfony\Component\Console\Attribute\AsCommand;
14
use Symfony\Component\Console\Command\Command;
15
use Symfony\Component\Console\Input\InputArgument;
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18
use Throwable;
19

20

21
/**
22
 * Command for generating a data class from a database table.
23
 */
24
#[AsCommand(name: 'app:dataClass')]
25
class DataClassCommand extends Command
26
{
27
        /**
28
         * Constructor for DataClassCommand.
29
         * @param DataClassGenerator $dataClassGenerator
30
         */
31
        public function __construct(
2✔
32
                private readonly DataClassGenerator $dataClassGenerator,
33
        ) {
34
                parent::__construct();
2✔
35
        }
2✔
36

37

38
        /**
39
         * Configures the current command.
40
         */
41
        protected function configure(): void
42
        {
43
                $this->setDescription('Generates entity classes from a database table.')
2✔
44
                        ->addArgument('table', InputArgument::OPTIONAL, 'The name of the database table');
2✔
45
        }
2✔
46

47

48
        /**
49
         * Executes the command.
50
         * @throws Throwable
51
         */
52
        protected function execute(InputInterface $input, OutputInterface $output): int
53
        {
54
                try {
55
                        $this->dataClassGenerator->runGeneration($input->getArgument('table'));
×
NEW
56
                        $output->writeln('✅ Generation was successful.');
×
57
                } catch (Throwable $exception) {
×
58
                        $output->writeln('<error>Error: ' . $exception->getMessage() . '</error>');
×
59
                        return Command::FAILURE;
×
60
                }
61

62
                return Command::SUCCESS;
×
63
        }
64
}
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