Skip to content

Commit abe4ecb

Browse files
committed
Better log output.
1 parent 01daaf4 commit abe4ecb

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/Propel/Generator/Manager/ReverseManager.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,17 @@ protected function buildModel()
215215
$nbTables = $parser->parse($database);
216216

217217
$excludeTables = $config->getConfigProperty('exclude_tables');
218-
$tables = [];
218+
$tableNames = [];
219219

220220
foreach ($database->getTables() as $table) {
221221
$skip = false;
222-
$tablename = $table->getName();
222+
$tableName = $table->getName();
223223

224-
if (in_array($tablename, $excludeTables, true)) {
224+
if (in_array($tableName, $excludeTables, true)) {
225225
$skip = true;
226226
} else {
227227
foreach ($excludeTables as $excludeTable) {
228-
if (preg_match('/^' . str_replace('*', '.*', $excludeTable) . '$/', $tablename)) {
228+
if (preg_match('/^' . str_replace('*', '.*', $excludeTable) . '$/', $tableName)) {
229229
$skip = true;
230230
break;
231231
}
@@ -236,10 +236,14 @@ protected function buildModel()
236236
continue;
237237
}
238238

239+
$tableNames[] = $table;
240+
239241
$database->removeTable($table);
240242
}
241243

242-
$this->log(sprintf('Successfully reverse engineered %d tables', $nbTables));
244+
if ($tableNames) {
245+
$this->log(sprintf('Successfully reverse engineered %d/%d tables (%s)', count($tableNames), $nbTables, implode(', ', $tableNames)));
246+
}
243247

244248
return $database;
245249
}

tests/Propel/Tests/Generator/Command/DatabaseReverseTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Propel\Tests\Generator\Command;
44

5+
use Propel\Generator\Command\AbstractCommand;
56
use Propel\Generator\Command\DatabaseReverseCommand;
67
use Propel\Runtime\Propel;
78
use Propel\Tests\TestCaseFixturesDatabase;
@@ -38,11 +39,11 @@ public function testCommandWithoutNamespace()
3839

3940
chdir($currentDir);
4041

41-
if (0 !== $result) {
42+
if (AbstractCommand::CODE_SUCCESS !== $result) {
4243
rewind($output->getStream());
4344
echo stream_get_contents($output->getStream());
4445
}
45-
$this->assertEquals(0, $result, 'database:reverse tests exited successfully');
46+
$this->assertSame(AbstractCommand::CODE_SUCCESS, $result, 'database:reverse tests exited successfully');
4647

4748
$databaseXml = simplexml_load_file($outputDir . '/schema.xml');
4849
$this->assertEquals('reverse-test', $databaseXml['name']);

0 commit comments

Comments
 (0)