Fix Propel for MySQL 5.5 (also fixes is_object problems added in revision 11).

This commit is contained in:
Alexandre Rosenfeld
2011-02-22 15:11:49 +00:00
parent 116f773215
commit c84fb21d37
6 changed files with 8 additions and 7 deletions

View File

@@ -25,7 +25,7 @@ require_once 'propel/engine/builder/sql/DDLBuilder.php';
/** /**
* DDL Builder class for MySQL. * DDL Builder class for MySQL.
* *
* @author David Z<>lke * @author David Z<>lke
* @author Hans Lellelid <hans@xmpl.org> * @author Hans Lellelid <hans@xmpl.org>
* @package propel.engine.builder.sql.mysql * @package propel.engine.builder.sql.mysql
*/ */
@@ -142,7 +142,7 @@ CREATE TABLE ".$this->quoteIdentifier($table->getName())."
} }
} }
$script .= "Type=$mysqlTableType "; $script .= "ENGINE=$mysqlTableType ";
// print_r ($vendorSpecific); // print_r ($vendorSpecific);
if($vendorSpecific['Collation'] ) { if($vendorSpecific['Collation'] ) {
// $script .= " DEFAULT CHARSET='". $platform->escapeText( $vendorSpecific['Collation'] )."'"; // $script .= " DEFAULT CHARSET='". $platform->escapeText( $vendorSpecific['Collation'] )."'";

View File

@@ -427,7 +427,8 @@ class Table extends XMLElement implements IDMethod {
$children = $this->inheritanceColumn->getChildren(); $children = $this->inheritanceColumn->getChildren();
$names = array(); $names = array();
for ($i = 0, $size=count($children); $i < $size; $i++) { for ($i = 0, $size=count($children); $i < $size; $i++) {
$names[] = is_object($children[$i]) && get_class($children[$i]); if (is_object($children[$i]))
$names[] = get_class($children[$i]);
} }
return $names; return $names;
} }

View File

@@ -64,7 +64,7 @@ class DefaultPlatform implements Platform {
*/ */
public function getDatabaseType() public function getDatabaseType()
{ {
$clazz = is_object($this) && get_class($this); $clazz = is_object($this) ? get_class($this) : 'NULL';
$pos = strpos($clazz, 'Platform'); $pos = strpos($clazz, 'Platform');
return strtolower(substr($clazz,0,$pos)); return strtolower(substr($clazz,0,$pos));
} }

View File

@@ -84,7 +84,7 @@ class PropelOMTask extends AbstractPropelDataModelTask {
$_f = new PhingFile($this->getOutputDirectory(), $path); $_f = new PhingFile($this->getOutputDirectory(), $path);
if ($overwrite || !$_f->exists()) { if ($overwrite || !$_f->exists()) {
$this->log("\t\t-> " . $builder->getClassname() . " [builder: " .is_object($builder) && get_class($builder) . "]"); $this->log("\t\t-> " . $builder->getClassname() . " [builder: " . (is_object($builder) ? get_class($builder) : '') . "]");
$script = $builder->build(); $script = $builder->build();
file_put_contents($_f->getAbsolutePath(), $script); file_put_contents($_f->getAbsolutePath(), $script);
foreach($builder->getWarnings() as $warning) { foreach($builder->getWarnings() as $warning) {

View File

@@ -175,7 +175,7 @@ class PropelSQLTask extends AbstractPropelDataModelTask {
if (!$table->isSkipSql()) { if (!$table->isSkipSql()) {
$builder = DataModelBuilder::builderFactory($table, 'ddl'); $builder = DataModelBuilder::builderFactory($table, 'ddl');
$this->log("\t+ " . $table->getName() . " [builder: " . is_object($builder) && get_class($builder) . "]"); $this->log("\t+ " . $table->getName() . " [builder: " . (is_object($builder) ? get_class($builder) : "NULL") . "]");
$ddl .= $builder->build(); $ddl .= $builder->build();
foreach($builder->getWarnings() as $warning) { foreach($builder->getWarnings() as $warning) {
$this->log($warning, PROJECT_MSG_WARN); $this->log($warning, PROJECT_MSG_WARN);

View File

@@ -181,7 +181,7 @@ abstract class BaseObject {
*/ */
protected function log($msg, $priority = Propel::LOG_INFO) protected function log($msg, $priority = Propel::LOG_INFO)
{ {
return Propel::log(is_object($this) && get_class($this) . ': ' . $msg, $priority); return Propel::log((is_object($this) ? get_class($this) : 'NULL') . ': ' . $msg, $priority);
} }
} }