Commit e1645efa authored by jwage's avatar jwage

[2.0] Misc. bug fixes

parent d1228063
......@@ -123,9 +123,12 @@ abstract class AbstractPrinter
*/
public function getStyle($name)
{
$name = strtoupper($name);
return isset($this->_styles[$name]) ? $this->_styles[$name] : null;
if (is_string($name)) {
$name = strtoupper($name);
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')
{
$style = is_string($style) ? $this->getStyle($style) : $style;
fwrite($this->_stream, $this->format($message, $style));
return $this;
......@@ -171,5 +172,5 @@ abstract class AbstractPrinter
* @param mixed $style Style to be applied in message
* @return string Formatted message
*/
abstract public function format($message, Style $style);
abstract public function format($message, $style);
}
\ No newline at end of file
......@@ -57,12 +57,12 @@ class AnsiColorPrinter extends AbstractPrinter
/**
* @inheritdoc
*/
public function format($message, Style $style)
public function format($message, $style)
{
if ( ! $this->_supportsColor()) {
return $message;
}
$style = $this->getStyle($style);
$str = $this->_getForegroundString($style->getForeground())
. $this->_getBackgroundString($style->getBackground())
. $this->_getOptionsString($style->getOptions());
......
......@@ -39,7 +39,7 @@ class NormalPrinter extends AbstractPrinter
/**
* @inheritdoc
*/
public function format($message, Style $style)
public function format($message, $style)
{
return $message;
}
......
......@@ -139,7 +139,13 @@ class ConvertMappingTask extends AbstractTask
$type = $this->_determineSourceType($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);
}
......@@ -147,11 +153,22 @@ class ConvertMappingTask extends AbstractTask
}
foreach ($metadatas as $metadata) {
$printer->write('Processing entity "')
->write($metadata->name, 'KEYWORD')->writeln('"');
$printer->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->export();
......@@ -179,7 +196,9 @@ class ConvertMappingTask extends AbstractTask
// Find the files in the directory
$files = glob($source . '/*.*');
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
......
......@@ -435,7 +435,8 @@ class SchemaTool
for ($i = count($commitOrder) - 1; $i >= 0; --$i) {
$class = $commitOrder[$i];
if ($class->isInheritanceTypeSingleTable() && $class->name != $class->rootEntityName) {
if (($class->isInheritanceTypeSingleTable() && $class->name != $class->rootEntityName)
|| $class->isMappedSuperclass) {
continue;
}
......@@ -628,6 +629,7 @@ class SchemaTool
}
foreach ($newJoinColumns as $name => $joinColumn) {
$joinColumn['type'] = Type::getType($joinColumn['type']);
$changes['add'][$name] = $joinColumn;
}
$sql[] = $this->_platform->getAlterTableSql($tableName, $changes);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment