Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updated checks Driver Platforms and namespaces

- Class checks implemented, since Doctrine 2.1+ migrated away from MsSqlPlatformSchema
- Updated namespace path for better compatibility within your app's vendor directory
- Updated readme
  • Loading branch information...
commit 7ea000d07b5a852e4a8b7e3568bc82f7f7df05df 1 parent e0f5ba9
Tyler Rooney authored
2  Doctrine/DBAL/Driver/PDODblib/Connection.php
@@ -19,7 +19,7 @@
19 19 * <http://www.doctrine-project.org>.
20 20 */
21 21
22   -namespace Doctrine\DBAL\Driver\PDODblib;
  22 +namespace PDODblibBundle\Doctrine\DBAL\Driver\PDODblib;
23 23
24 24 /**
25 25 * PDODblib Connection implementation.
22 Doctrine/DBAL/Driver/PDODblib/Driver.php
@@ -19,7 +19,7 @@
19 19 * <http://www.doctrine-project.org>.
20 20 */
21 21
22   -namespace Doctrine\DBAL\Driver\PDODblib;
  22 +namespace PDODblibBundle\Doctrine\DBAL\Driver\PDODblib;
23 23
24 24 /**
25 25 * The PDO-based Dblib driver.
@@ -60,13 +60,25 @@ private function _constructPdoDsn(array $params) {
60 60 }
61 61
62 62 public function getDatabasePlatform() {
63   - //return new \Doctrine\DBAL\Platforms\MsSqlPlatform();
64   - return new \Doctrine\DBAL\Platforms\SQLServer2005Platform();
  63 + if (class_exists('\\Doctrine\\DBAL\\Platforms\\SQLServer2005Platform')) {
  64 + return new \Doctrine\DBAL\Platforms\SQLServer2005Platform();
  65 + }
  66 +
  67 + if (class_exists('\\Doctrine\\DBAL\\Platforms\\MsSqlPlatform')) {
  68 + return new \Doctrine\DBAL\Platforms\MsSqlPlatform();
  69 + }
65 70 }
66 71
67 72 public function getSchemaManager(\Doctrine\DBAL\Connection $conn) {
68   - //return new \Doctrine\DBAL\Schema\MsSqlSchemaManager($conn);
69   - return new \Doctrine\DBAL\Schema\SQLServerSchemaManager($conn);
  73 + if (class_exists('\\Doctrine\\DBAL\\Schema\\SQLServerSchemaManager')) {
  74 + return new \Doctrine\DBAL\Schema\SQLServerSchemaManager($conn);
  75 + }
  76 +
  77 + if (class_exists('\\Doctrine\\DBAL\\Schema\\MsSqlSchemaManager')) {
  78 + return new \Doctrine\DBAL\Schema\MsSqlSchemaManager($conn);
  79 + }
  80 +
  81 +
70 82 }
71 83
72 84 public function getName() {
64 README.md
Source Rendered
@@ -7,29 +7,6 @@ This bundle requires the following:
7 7 * pdo_dblib
8 8 * FreeTDS
9 9
10   -Since Doctrine 2 not allow you to add custom database drivers on the fly, if you want to test this package, `Doctrine/DBAL/Driver/DriverManager::$_driverMap` as follows:
11   -
12   -```php
13   -final class DriverManager
14   -{
15   - private static $_driverMap = array(
16   - /* ... snip ... */
17   - 'pdo_dblib' => 'Doctrine\DBAL\Driver\PDODblib\Driver',
18   - );
19   -}
20   -```
21   -
22   -PHP pdo_dblib patch
23   -===================
24   -
25   -You can find a patch for some of the short-comings of pdo_dblib on SVN.
26   -
27   -http://svn.php.net/viewvc/php/php-src/trunk/ext/pdo_dblib/dblib_driver.c?view=log
28   -
29   -See:
30   -Revision 300647 - lastInsertId
31   -Revision 300628 - transaction support
32   -
33 10 FreeTDS configuration
34 11 =====================
35 12
@@ -59,6 +36,12 @@ doctrine:
59 36
60 37 ```
61 38
  39 +And in your `autoload.php` register the new bundle:
  40 +```php
  41 +$loader->registerNamespaces(array(
  42 + 'PDODblib' => __DIR__ . '/../vendor/bundles',
  43 +));
  44 +```
62 45
63 46 Putting everything together
64 47 ===========================
@@ -73,3 +56,38 @@ Getting everything together wasn't easy. You need to complete the following step
73 56 * *Verify* Some kind of SQL against your database
74 57
75 58
  59 +FYI - PHP pdo_dblib patch
  60 +=========================
  61 +
  62 +You can find a patch for some of the short-comings of pdo_dblib on SVN.
  63 +
  64 +http://svn.php.net/viewvc/php/php-src/trunk/ext/pdo_dblib/dblib_driver.c?view=log
  65 +
  66 +See:
  67 +Revision 300647 - lastInsertId
  68 +Revision 300628 - transaction support
  69 +
  70 +FYI - Doctrine Test Suite
  71 +=========================
  72 +
  73 +Doctrine2's test suite does not allow you to add database drivers on the fly. If you want to test this package, modify `Doctrine/DBAL/Driver/DriverManager::$_driverMap` as follows:
  74 +
  75 +```php
  76 +final class DriverManager
  77 +{
  78 + private static $_driverMap = array(
  79 + /* ... snip ... */
  80 + 'pdo_dblib' => 'Doctrine\DBAL\Driver\PDODblib\Driver',
  81 + );
  82 +}
  83 +```
  84 +
  85 +FYI - Generating Entities from database
  86 +=======================================
  87 +
  88 +It's possible, but not easy. Here's what I did:
  89 +
  90 +- Map any non-compatible column types to string
  91 +- Hack the Doctrine core to skip any tables without primary keys
  92 +
  93 +

0 comments on commit 7ea000d

Please sign in to comment.
Something went wrong with that request. Please try again.