Skip to content

PropelQuickBuilder: getDatabase() does not set the right platform #472

emagma opened this Issue Sep 21, 2012 · 2 comments

3 participants

emagma commented Sep 21, 2012

Trying to unit-test a behavior following this guide I met and IDENTITY error at insert time in the sqlite database.
I changed the platform, adapter and dsn for using a mysql database and the issue remains.
I figured out that the getDatabase() method in PropelQuickBuilder does not pass the Platform to the Database object, and then the Dabase object uses the DefaultPlatform wihich returns "IDENTITY" for autoIncrement string.
I fixed my issue by modifying PropelQuickBuilder.php

// line 146
public function getSQL()
return $this->getPlatform()->getAddTablesDDL($this->getDatabase());

Does anyone met this issue too ?


Hey, this is what I'm doing...

\Propel::setConnection("propel", \Propel::getConnection(SqliteSetup::$databaseName));

This makes my test db defined in the config my propel default and then all my models will work with the default connection. As for init the sqlite instance...

public static $databaseName = "test"; //where test is the name of the db in the config and schema
$this->con = \Propel::getConnection(self::$databaseName);

 * Builds out the SQLite Database into memory based on the schema we pass into it
 * @param \PropelPDO $connection
public function buildSqliteDb(\PropelPDO $connection = null) {
        $connection = $this->con;

    $tables = $this->getTables();

    //if we don't have these tables in the array, build the tables
    if(!in_array("company", $tables) && !in_array("zip_code", $tables)) {
        $builder = new PropelQuickBuilderModified();

        $config = $builder->getConfig();

        $schema = $this->getSchema();


Hope that helps get you somewhere.

Propel member
@willdurand willdurand closed this Nov 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.