Skip to content

Commit 879e1b6

Browse files
authored
[console] Remove gabordemooij/redbean dependency. (#3799)
1 parent 08a0c78 commit 879e1b6

4 files changed

Lines changed: 9 additions & 20 deletions

File tree

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
"drupal/console-core": "dev-master",
4545
"drupal/console-dotenv": "~0",
4646
"drupal/console-extend-plugin": "~0",
47-
"gabordemooij/redbean": "~4.3",
4847
"guzzlehttp/guzzle": "~6.1",
4948
"psy/psysh": "0.6.* || ~0.8",
5049
"symfony/css-selector": "~2.8|~3.0",

config/services/debug.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ services:
8787
- { name: drupal.command }
8888
console.database_table_debug:
8989
class: Drupal\Console\Command\Debug\DatabaseTableCommand
90-
arguments: ['@console.redbean', '@database']
90+
arguments: ['@database']
9191
tags:
9292
- { name: drupal.command }
9393
console.cron_debug:

services.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ services:
33
class: SplString
44
console.cache_key:
55
class: SplString
6-
console.redbean:
7-
class: RedBeanPHP\R
86
console.validator:
97
class: Drupal\Console\Utils\Validator
108
arguments: ['@console.extension_manager', '@console.translator_manager']

src/Command/Debug/DatabaseTableCommand.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,14 @@ class DatabaseTableCommand extends Command
3030
*/
3131
protected $database;
3232

33-
/**
34-
* @var R
35-
*/
36-
protected $redBean;
37-
3833
/**
3934
* DatabaseTableCommand constructor.
4035
*
41-
* @param R $redBean
4236
* @param Connection $database
4337
*/
4438
public function __construct(
45-
R $redBean,
4639
Connection $database
4740
) {
48-
$this->redBean = $redBean;
4941
$this->database = $database;
5042
parent::__construct();
5143
}
@@ -82,30 +74,30 @@ protected function execute(InputInterface $input, OutputInterface $output)
8274
{
8375
$database = $input->getOption('database');
8476
$table = $input->getArgument('table');
85-
8677
$databaseConnection = $this->resolveConnection($database);
87-
8878
if ($table) {
89-
$this->redBean = $this->getRedBeanConnection($database);
90-
if (empty($this->redBean)) {
79+
$result = $this->database
80+
->query('DESCRIBE '. $table .';')
81+
->fetchAll();
82+
if (!$result) {
9183
throw new \Exception(
9284
sprintf(
9385
$this->trans('commands.debug.database.table.messages.no-connection'),
9486
$database
9587
)
9688
);
9789
}
98-
$tableInfo = $this->redBean->inspect($table);
9990

10091
$tableHeader = [
10192
$this->trans('commands.debug.database.table.messages.column'),
10293
$this->trans('commands.debug.database.table.messages.type')
10394
];
10495
$tableRows = [];
105-
foreach ($tableInfo as $column => $type) {
96+
foreach ($result as $record) {
97+
$column = json_decode(json_encode($record), true);
10698
$tableRows[] = [
107-
'column' => $column,
108-
'type' => $type
99+
'column' => $column['Field'],
100+
'type' => $column['Type'],
109101
];
110102
}
111103

0 commit comments

Comments
 (0)