Exemplo n.º 1
0
 /**
  * Getter for the platform property
  *
  * @return PlatformInterface
  */
 public function getPlatform()
 {
     if (null === $this->platform) {
         $this->platform = new SqlitePlatform();
     }
     $this->platform->setIdentifierQuoting($this->identifierQuoting);
     return $this->platform;
 }
Exemplo n.º 2
0
 public function setUp()
 {
     if (!$this->con) {
         require_once __DIR__ . '/../../../../Fixtures/migration/build/conf/migration-conf.php';
         $this->con = Propel::getConnection('migration');
         $adapterClass = Propel::getServiceContainer()->getAdapterClass('migration');
         $this->database = new Database();
         $schemaParserClass = sprintf('\\%s\\%sSchemaParser', 'Propel\\Generator\\Reverse', ucfirst($adapterClass));
         $platformClass = sprintf('\\%s\\%sPlatform', 'Propel\\Generator\\Platform', ucfirst($adapterClass));
         $this->parser = new $schemaParserClass($this->con);
         $this->platform = new $platformClass();
         $generatorConfig = new QuickGeneratorConfig();
         $generatorConfig->setBuildProperty('mysqlTableType', 'InnoDB');
         $this->platform->setGeneratorConfig($generatorConfig);
         $this->parser->setGeneratorConfig(new QuickGeneratorConfig());
         $this->parser->setPlatform($this->platform);
     }
 }
Exemplo n.º 3
0
 public function isDefaultSqlType(PlatformInterface $platform = null)
 {
     if (null === $this->domain || null === $this->domain->getSqlType() || null === $platform) {
         return true;
     }
     $defaultSqlType = $platform->getDomainForType($this->getType())->getSqlType();
     return $defaultSqlType === $this->getDomain()->getSqlType();
 }
Exemplo n.º 4
0
 /**
  * Returns the schema delimiter character.
  *
  * For example, the dot character with mysql when
  * naming tables. For instance: schema.the_table.
  *
  * @return string
  */
 public function getSchemaDelimiter()
 {
     return $this->platform->getSchemaDelimiter();
 }
Exemplo n.º 5
0
 /**
  * Convenience method to returns the Platform class for this table (database).
  * @return PlatformInterface
  */
 public function getPlatform()
 {
     if (null === $this->platform) {
         // try to load the platform from the table
         $table = $this->getTable();
         if ($table && ($database = $table->getDatabase())) {
             $this->setPlatform($database->getPlatform());
         }
     }
     if (!$this->table->isIdentifierQuotingEnabled()) {
         $this->platform->setIdentifierQuoting(false);
     }
     return $this->platform;
 }