@@ -33,8 +33,7 @@ It is written in pure PHP and does not require any extensions.
3333This example runs a simple ` SELECT ` query and dumps all the records from a ` book ` table:
3434
3535``` php
36- $loop = React\EventLoop\Factory::create();
37- $factory = new Factory($loop);
36+ $factory = new React\MySQL\Factory();
3837
3938$uri = 'test:test@localhost/test';
4039$connection = $factory->createLazyConnection($uri);
@@ -51,8 +50,6 @@ $connection->query('SELECT * FROM book')->then(
5150);
5251
5352$connection->quit();
54-
55- $loop->run();
5653```
5754
5855See also the [ examples] ( examples ) .
@@ -62,19 +59,23 @@ See also the [examples](examples).
6259### Factory
6360
6461The ` Factory ` is responsible for creating your [ ` ConnectionInterface ` ] ( #connectioninterface ) instance.
65- It also registers everything with the main [ ` EventLoop ` ] ( https://github.com/reactphp/event-loop#usage ) .
6662
6763``` php
68- $loop = \React\EventLoop\Factory::create();
69- $factory = new Factory($loop);
64+ $factory = new React\MySQL\Factory();
7065```
7166
67+ This class takes an optional ` LoopInterface|null $loop ` parameter that can be used to
68+ pass the event loop instance to use for this object. You can use a ` null ` value
69+ here in order to use the [ default loop] ( https://github.com/reactphp/event-loop#loop ) .
70+ This value SHOULD NOT be given unless you're sure you want to explicitly use a
71+ given event loop instance.
72+
7273If you need custom connector settings (DNS resolution, TLS parameters, timeouts,
7374proxy servers etc.), you can explicitly pass a custom instance of the
7475[ ` ConnectorInterface ` ] ( https://github.com/reactphp/socket#connectorinterface ) :
7576
7677``` php
77- $connector = new \ React\Socket\Connector($loop , array(
78+ $connector = new React\Socket\Connector(null , array(
7879 'dns' => '127.0.0.1',
7980 'tcp' => array(
8081 'bindto' => '192.168.10.1:0'
@@ -85,7 +86,7 @@ $connector = new \React\Socket\Connector($loop, array(
8586 )
8687));
8788
88- $factory = new Factory($loop , $connector);
89+ $factory = new React\MySQL\ Factory(null , $connector);
8990```
9091
9192#### createConnection()
@@ -120,7 +121,7 @@ connection attempt and/or MySQL authentication.
120121``` php
121122$promise = $factory->createConnection($url);
122123
123- $loop-> addTimer(3.0, function () use ($promise) {
124+ Loop:: addTimer(3.0, function () use ($promise) {
124125 $promise->cancel();
125126});
126127```
0 commit comments