Conditions | 4 |
Paths | 4 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
35 | public function __invoke(InputInterface $input, OutputInterface $output) |
||
36 | { |
||
37 | if (($sql = $input->getArgument('sql')) === null) { |
||
38 | throw new \RuntimeException("Argument 'SQL' is required in order to execute this command correctly."); |
||
39 | } |
||
40 | |||
41 | $depth = $input->getOption('depth'); |
||
42 | |||
43 | if (!is_numeric($depth)) { |
||
44 | throw new \LogicException("Option 'depth' must contains an integer value"); |
||
45 | } |
||
46 | |||
47 | if (stripos($sql, 'select') === 0) { |
||
48 | $resultSet = $this->connection->fetchAll($sql); |
||
49 | } else { |
||
50 | $resultSet = $this->connection->executeUpdate($sql); |
||
51 | } |
||
52 | |||
53 | $message = \Doctrine\Common\Util\Debug::dump($resultSet, (int) $depth, true, false); |
||
54 | |||
55 | $output->write($message); |
||
56 | } |
||
57 | } |
||
58 |