Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e33894a

Browse filesBrowse files
jwagefabpot
authored andcommitted
[DoctrineBundle] Fixing issue with doctrine:generate:entity command when no --fields are specified
1 parent 909ea54 commit e33894a
Copy full SHA for e33894a

File tree

Expand file treeCollapse file tree

1 file changed

+16
-13
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-13
lines changed

‎src/Symfony/Bundle/DoctrineBundle/Command/GenerateEntityDoctrineCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/DoctrineBundle/Command/GenerateEntityDoctrineCommand.php
+16-13Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,22 @@ protected function execute(InputInterface $input, OutputInterface $output)
8787

8888
// Map the specified fields
8989
$fields = $input->getOption('fields');
90-
$e = explode(' ', $fields);
91-
foreach ($e as $value) {
92-
$e = explode(':', $value);
93-
$name = $e[0];
94-
$type = isset($e[1]) ? $e[1] : 'string';
95-
preg_match_all('/(.*)\((.*)\)/', $type, $matches);
96-
$type = isset($matches[1][0]) ? $matches[1][0] : 'string';
97-
$length = isset($matches[2][0]) ? $matches[2][0] : null;
98-
$class->mapField(array(
99-
'fieldName' => $name,
100-
'type' => $type,
101-
'length' => $length
102-
));
90+
if ($fields)
91+
{
92+
$e = explode(' ', $fields);
93+
foreach ($e as $value) {
94+
$e = explode(':', $value);
95+
$name = $e[0];
96+
$type = isset($e[1]) ? $e[1] : 'string';
97+
preg_match_all('/(.*)\((.*)\)/', $type, $matches);
98+
$type = isset($matches[1][0]) ? $matches[1][0] : 'string';
99+
$length = isset($matches[2][0]) ? $matches[2][0] : null;
100+
$class->mapField(array(
101+
'fieldName' => $name,
102+
'type' => $type,
103+
'length' => $length
104+
));
105+
}
103106
}
104107

105108
// Setup a new exporter for the mapping type specified

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.