Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix: issue #301 #302

Merged
merged 1 commit into from

3 participants

@travisbot

This pull request passes (merged 8b84a20 into c8dcbc9).

@willdurand willdurand merged commit 4656d45 into from
@willdurand
Owner

Great, thanks a lot!

@jeremyFreeAgent jeremyFreeAgent referenced this pull request from a commit in jeremyFreeAgent/Propel2
@K-Phoen K-Phoen Fix: port PR #302 from Propel c658cc0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 29, 2012
  1. @K-Phoen

    Fix: issue #301

    K-Phoen authored
This page is out of date. Refresh to see the latest.
View
3  src/Propel/Generator/Model/Database.php
@@ -416,11 +416,12 @@ public function addTable($table)
return $this->addTable($tbl);
}
+ $table->setDatabase($this);
+
if (isset($this->tablesByName[$table->getName()])) {
throw new EngineException(sprintf('Table "%s" declared twice', $table->getName()));
}
- $table->setDatabase($this);
if (null === $table->getSchema()) {
$table->setSchema($this->getSchema());
}
View
17 tests/Propel/Tests/Generator/Model/DatabaseTest.php
@@ -11,6 +11,8 @@
namespace Propel\Tests\Generator\Model;
use Propel\Generator\Model\Database;
+use Propel\Generator\Model\Table;
+use Propel\Generator\Platform\PgsqlPlatform;
/**
* Unit test suite for Database model class.
@@ -418,4 +420,19 @@ public function testSetDefaultPhpNamingMethodStrategy()
$this->assertSame('foo', $database->getDefaultPhpNamingMethod());
}
+
+ public function testAddTableWithSameNameOnDifferentSchema()
+ {
+ $db = new Database();
+ $db->setPlatform(new PgsqlPlatform());
+
+ $t1 = new Table('t1');
+ $db->addTable($t1);
+ $this->assertEquals('t1', $t1->getName());
+
+ $t1b = new Table('t1');
+ $t1b->setSchema('bis');
+ $db->addTable($t1b);
+ $this->assertEquals('bis.t1', $t1b->getName());
+ }
}
Something went wrong with that request. Please try again.