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

drago-ex / generator / 12947105156

24 Jan 2025 09:42AM UTC coverage: 84.018% (-3.1%) from 87.111%
12947105156

push

github

web-flow
Update DataClassGenerator.phpt

184 of 219 relevant lines covered (84.02%)

0.84 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\Command\Command;
14
use Symfony\Component\Console\Input\InputArgument;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Output\OutputInterface;
17
use Throwable;
18

19

20
/**
21
 * Command for generating a data class from a database table.
22
 */
23
class DataClassCommand extends Command
24
{
25
        /** @var string Command name */
26
        protected static $defaultName = 'make:dataClass';
27

28

29
        /**
30
         * Constructor for DataClassCommand.
31
         * @param DataClassGenerator $dataClassGenerator
32
         */
33
        public function __construct(
1✔
34
                private readonly DataClassGenerator $dataClassGenerator,
35
        ) {
36
                parent::__construct();
1✔
37
        }
1✔
38

39

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

49

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

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