Commit fa633fb7 authored by zYne's avatar zYne

Little isValidClassname fix

parent 82c13ca1
...@@ -134,7 +134,7 @@ class Doctrine_DataDict { ...@@ -134,7 +134,7 @@ class Doctrine_DataDict {
*/ */
public static function isValidClassname($classname) { public static function isValidClassname($classname) {
if(preg_match('~(^[a-z])|(_[a-z])|([\W])|(_{2})~', $classname)) if(preg_match('~(^[a-z])|(_[a-z])|([\W])|(_{2})~', $classname))
throw new Doctrine_Exception("Class name is not valid. use camel case and underscores (i.e My_PerfectClass)."); throw new Doctrine_Exception("Class name is not valid. Use camel case and underscores (i.e My_PerfectClass).");
return true; return true;
} }
} }
......
...@@ -205,10 +205,12 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable { ...@@ -205,10 +205,12 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
} }
endswitch; endswitch;
if(Doctrine_DataDict::isValidClassname($class->getName()) && $this->getAttribute(Doctrine::ATTR_CREATE_TABLES)) { if($this->getAttribute(Doctrine::ATTR_CREATE_TABLES)) {
if(Doctrine_DataDict::isValidClassname($class->getName())) {
$dict = new Doctrine_DataDict($this->getConnection()->getDBH()); $dict = new Doctrine_DataDict($this->getConnection()->getDBH());
$dict->createTable($this->tableName, $this->columns); $dict->createTable($this->tableName, $this->columns);
} }
}
} }
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment