public function build($dsn = null, $user = null, $pass = null, $adapter = null) { if (null === $dsn) { $dsn = 'sqlite::memory:'; } if (null === $adapter) { $adapter = new \Propel\Runtime\Adapter\DBSQLite(); } $con = new PropelPDO($dsn, $user, $pass); $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); $this->buildSQL($con); $this->buildClasses(); $name = $this->getDatabase()->getName(); if (!Propel::isInit()) { Propel::setConfiguration(array('datasources' => array('default' => $name))); } Propel::setDB($name, $adapter); Propel::setConnection($name, $con, Propel::CONNECTION_READ); Propel::setConnection($name, $con, Propel::CONNECTION_WRITE); return $con; }