@@ -47,23 +47,37 @@ for all available versions.
47
47
Setup
48
48
--
49
49
50
- To use the library with the Doctrine ORM, register the
51
- ` ORMSchemaEventSubscriber ` event subscriber .
50
+ Basic setup requires registering Middleware and the SchemaManagerFactory via the
51
+ DBAL connection configuration .
52
52
53
53
``` php
54
+ use Doctrine\DBAL\Configuration;
55
+ use Doctrine\DBAL\Connection;
56
+ use Doctrine\DBAL\Driver\PgSQL\Driver;
57
+ use Jsor\Doctrine\PostGIS\Driver\Middleware;
54
58
use Jsor\Doctrine\PostGIS\Event\ORMSchemaEventSubscriber;
59
+ use Jsor\Doctrine\PostGIS\Schema\SchemaManagerFactory;
55
60
56
- $entityManager->getEventManager()->addEventSubscriber(new ORMSchemaEventSubscriber());
61
+ $params = [
62
+ // your connection parameters …
63
+ ];
64
+ $config = new Configuration();
65
+ $config->setMiddlewares([new Middleware]);
66
+ $config->setSchemaManagerFactory(new SchemaManagerFactory());
67
+
68
+ $connection = new Connection($params, new Driver(), $config);
57
69
```
58
70
59
- To use it with the DBAL only, register the ` DBALSchemaEventSubscriber ` event
60
- subscriber.
71
+
72
+ Additionally, to also use the library with the Doctrine ORM, register the
73
+ ` ORMSchemaEventListener ` event subscriber.
61
74
62
75
``` php
63
- use Jsor\Doctrine\PostGIS\Event\DBALSchemaEventSubscriber ;
76
+ use Jsor\Doctrine\PostGIS\Event\ORMSchemaEventListener ;
64
77
65
- $connection ->getEventManager()->addEventSubscriber(new DBALSchemaEventSubscriber ());
78
+ $entityManager ->getEventManager()->addEventSubscriber(new ORMSchemaEventSubscriber ());
66
79
```
80
+
67
81
### Symfony
68
82
69
83
For integrating this library into a Symfony project, read the dedicated
0 commit comments