1
0
mirror of synced 2025-01-30 20:11:49 +03:00

[2.0] Misc. bug fixes

This commit is contained in:
jwage 2009-10-07 07:45:08 +00:00
parent d1228063e6
commit e1645efa76
5 changed files with 37 additions and 15 deletions

View File

@ -123,9 +123,12 @@ abstract class AbstractPrinter
*/ */
public function getStyle($name) public function getStyle($name)
{ {
$name = strtoupper($name); if (is_string($name)) {
$name = strtoupper($name);
return isset($this->_styles[$name]) ? $this->_styles[$name] : null; return isset($this->_styles[$name]) ? $this->_styles[$name] : null;
} else {
return $name;
}
} }
/** /**
@ -146,8 +149,6 @@ abstract class AbstractPrinter
*/ */
public function write($message, $style = 'NONE') public function write($message, $style = 'NONE')
{ {
$style = is_string($style) ? $this->getStyle($style) : $style;
fwrite($this->_stream, $this->format($message, $style)); fwrite($this->_stream, $this->format($message, $style));
return $this; return $this;
@ -171,5 +172,5 @@ abstract class AbstractPrinter
* @param mixed $style Style to be applied in message * @param mixed $style Style to be applied in message
* @return string Formatted message * @return string Formatted message
*/ */
abstract public function format($message, Style $style); abstract public function format($message, $style);
} }

View File

@ -57,12 +57,12 @@ class AnsiColorPrinter extends AbstractPrinter
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function format($message, Style $style) public function format($message, $style)
{ {
if ( ! $this->_supportsColor()) { if ( ! $this->_supportsColor()) {
return $message; return $message;
} }
$style = $this->getStyle($style);
$str = $this->_getForegroundString($style->getForeground()) $str = $this->_getForegroundString($style->getForeground())
. $this->_getBackgroundString($style->getBackground()) . $this->_getBackgroundString($style->getBackground())
. $this->_getOptionsString($style->getOptions()); . $this->_getOptionsString($style->getOptions());

View File

@ -39,7 +39,7 @@ class NormalPrinter extends AbstractPrinter
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function format($message, Style $style) public function format($message, $style)
{ {
return $message; return $message;
} }

View File

@ -139,7 +139,13 @@ class ConvertMappingTask extends AbstractTask
$type = $this->_determineSourceType($sourceArg); $type = $this->_determineSourceType($sourceArg);
$source = $this->_getSourceByType($type, $sourceArg); $source = $this->_getSourceByType($type, $sourceArg);
$printer->writeln(sprintf('Adding "%s" mapping source', $sourceArg), 'INFO'); $printer->writeln(
sprintf(
'Adding "%s" mapping source',
$printer->format($sourceArg, 'KEYWORD')
),
'INFO'
);
$cme->addMappingSource($source, $type); $cme->addMappingSource($source, $type);
} }
@ -147,11 +153,22 @@ class ConvertMappingTask extends AbstractTask
} }
foreach ($metadatas as $metadata) { foreach ($metadatas as $metadata) {
$printer->write('Processing entity "') $printer->writeln(
->write($metadata->name, 'KEYWORD')->writeln('"'); sprintf(
'Processing entity "%s"',
$printer->format($metadata->name, 'KEYWORD')
)
);
} }
$printer->writeln(sprintf('Exporting %s mapping information to directory "%s"', $args['to'], $args['dest']), 'INFO'); $printer->writeln(
sprintf(
'Exporting %s mapping information to directory "%s"',
$printer->format($args['to'], 'KEYWORD'),
$printer->format($args['dest'], 'KEYWORD')
),
'INFO'
);
$exporter->setMetadatas($metadatas); $exporter->setMetadatas($metadatas);
$exporter->export(); $exporter->export();
@ -179,7 +196,9 @@ class ConvertMappingTask extends AbstractTask
// Find the files in the directory // Find the files in the directory
$files = glob($source . '/*.*'); $files = glob($source . '/*.*');
if ( ! $files) { if ( ! $files) {
throw new \InvalidArgumentException(sprintf('No mapping files found in "%s"', $source)); throw new \InvalidArgumentException(
sprintf('No mapping files found in "%s"', $source)
);
} }
// Get the contents of the first file // Get the contents of the first file

View File

@ -435,7 +435,8 @@ class SchemaTool
for ($i = count($commitOrder) - 1; $i >= 0; --$i) { for ($i = count($commitOrder) - 1; $i >= 0; --$i) {
$class = $commitOrder[$i]; $class = $commitOrder[$i];
if ($class->isInheritanceTypeSingleTable() && $class->name != $class->rootEntityName) { if (($class->isInheritanceTypeSingleTable() && $class->name != $class->rootEntityName)
|| $class->isMappedSuperclass) {
continue; continue;
} }
@ -628,6 +629,7 @@ class SchemaTool
} }
foreach ($newJoinColumns as $name => $joinColumn) { foreach ($newJoinColumns as $name => $joinColumn) {
$joinColumn['type'] = Type::getType($joinColumn['type']);
$changes['add'][$name] = $joinColumn; $changes['add'][$name] = $joinColumn;
} }
$sql[] = $this->_platform->getAlterTableSql($tableName, $changes); $sql[] = $this->_platform->getAlterTableSql($tableName, $changes);