Permalink
Browse files

adding ENUM and SET types to DBAL, which resolves #52

  • Loading branch information...
1 parent f30a21a commit 047807d01fad7ea8d97f4661061af29da9fffadc @thepsion5 thepsion5 committed with = Mar 30, 2016
Showing with 17 additions and 0 deletions.
  1. +17 −0 src/CrudKit/Pages/MySQLTablePage.php
@@ -5,6 +5,17 @@
class MySQLTablePage extends BaseSQLDataPage
{
+ /**
+ * Adds support for MySQL-specific data types
+ * not automatically supported by Doctrine
+ *
+ * @var array
+ */
+ private $additionalTypeMappings = [
+ 'enum' => 'string',
+ 'set' => 'string'
+ ];
+
public function __construct($id, $user, $pass, $db, $extra = [])
{
$params = [
@@ -24,6 +35,12 @@ public function __construct($id, $user, $pass, $db, $extra = [])
$params['charset'] = $extra['charset'];
}
$conn = DriverManager::getConnection($params);
+
+ $platform = $conn->getDatabasePlatform();
+ foreach($this->additionalTypeMappings as $typeName => $type) {
+ $platform->registerDoctrineTypeMapping($typeName, $type);
+ }
+
$this->preInit($id, $conn);
}
}

0 comments on commit 047807d

Please sign in to comment.