Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix #281

  • Loading branch information...
commit 6eb19ea7857e829edba3c4822dff8efed7b28194 1 parent 7b30873
@willdurand willdurand authored
View
7 generator/lib/model/Column.php
@@ -232,7 +232,12 @@ protected function setupObject()
}
if ($this->getAttribute('valueSet', null) !== null) {
- $valueSet = explode(',', $this->getAttribute("valueSet"));
+ if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+ $valueSet = str_getcsv($this->getAttribute("valueSet"));
+ } else {
+ // unfortunately, no good fallback for PHP 5.2
+ $valueSet = explode(',', $this->getAttribute("valueSet"));
+ }
$valueSet = array_map('trim', $valueSet);
$this->valueSet = $valueSet;
}
View
20 test/testsuite/generator/model/ColumnTest.php
@@ -208,4 +208,24 @@ public function testIsPhpArrayType()
$column->setType(PropelTypes::PHP_ARRAY);
$this->assertTrue($column->isPhpArrayType());
}
+
+ public function testCommaInEnumValueSet()
+ {
+ $column = new Column();
+ $table = new Table();
+ $database = new Database();
+ $platform = new DefaultPlatform();
+
+ $table->addColumn($column);
+ $database->addTable($table);
+ $database->setPlatform($platform);
+
+ $column->loadFromXML(array('valueSet' => 'Foo, Bar, "Foo, Bar"'));
+ $valueSet = $column->getValueSet();
+
+ $this->assertCount(3, $valueSet);
+ $this->assertEquals('Foo', $valueSet[0]);
+ $this->assertEquals('Bar', $valueSet[1]);
+ $this->assertEquals('Foo, Bar', $valueSet[2]);
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.