@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | public function boot(Container $container, FinalizerInterface $finalizer, SchemaInterface $schema = null) |
47 | 47 | { |
48 | 48 | $finalizer->addFinalizer(function () use ($container) { |
49 | - if ($container->hasInstance(ORMInterface::class)) { |
|
49 | + if ($container->hasInstance(ORMInterface::class)){ |
|
50 | 50 | $container->get(ORMInterface::class)->getHeap()->clean(); |
51 | 51 | } |
52 | 52 | }); |
53 | 53 | |
54 | 54 | $container->bindInjector(Select::class, SelectInjector::class); |
55 | 55 | |
56 | - if ($schema !== null) { |
|
56 | + if ($schema !== null){ |
|
57 | 57 | $this->bindRepositories($container, $schema); |
58 | 58 | } |
59 | 59 | } |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function bindRepositories(Container $container, SchemaInterface $schema) |
68 | 68 | { |
69 | - foreach ($schema->getRoles() as $role) { |
|
69 | + foreach ($schema->getRoles() as $role){ |
|
70 | 70 | $repository = $schema->define($role, SchemaInterface::REPOSITORY); |
71 | - if ($repository === Select\Repository::class || $repository === null) { |
|
71 | + if ($repository === Select\Repository::class || $repository === null){ |
|
72 | 72 | // default repository can not be wired |
73 | 73 | continue; |
74 | 74 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | ): ORMInterface { |
105 | 105 | $orm = new ORM($factory, $schema); |
106 | 106 | |
107 | - if ($promiseFactory !== null) { |
|
107 | + if ($promiseFactory !== null){ |
|
108 | 108 | return $orm->withPromiseFactory($promiseFactory); |
109 | 109 | } |
110 | 110 |
@@ -45,15 +45,18 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function boot(Container $container, FinalizerInterface $finalizer, SchemaInterface $schema = null) |
47 | 47 | { |
48 | - $finalizer->addFinalizer(function () use ($container) { |
|
49 | - if ($container->hasInstance(ORMInterface::class)) { |
|
48 | + $finalizer->addFinalizer(function () use ($container) |
|
49 | + { |
|
50 | + if ($container->hasInstance(ORMInterface::class)) |
|
51 | + { |
|
50 | 52 | $container->get(ORMInterface::class)->getHeap()->clean(); |
51 | 53 | } |
52 | 54 | }); |
53 | 55 | |
54 | 56 | $container->bindInjector(Select::class, SelectInjector::class); |
55 | 57 | |
56 | - if ($schema !== null) { |
|
58 | + if ($schema !== null) |
|
59 | + { |
|
57 | 60 | $this->bindRepositories($container, $schema); |
58 | 61 | } |
59 | 62 | } |
@@ -66,15 +69,18 @@ discard block |
||
66 | 69 | */ |
67 | 70 | public function bindRepositories(Container $container, SchemaInterface $schema) |
68 | 71 | { |
69 | - foreach ($schema->getRoles() as $role) { |
|
72 | + foreach ($schema->getRoles() as $role) |
|
73 | + { |
|
70 | 74 | $repository = $schema->define($role, SchemaInterface::REPOSITORY); |
71 | - if ($repository === Select\Repository::class || $repository === null) { |
|
75 | + if ($repository === Select\Repository::class || $repository === null) |
|
76 | + { |
|
72 | 77 | // default repository can not be wired |
73 | 78 | continue; |
74 | 79 | } |
75 | 80 | |
76 | 81 | // initiate all repository dependencies using factory method forwarded to ORM |
77 | - $container->bindSingleton($repository, function (ORMInterface $orm) use ($role) { |
|
82 | + $container->bindSingleton($repository, function (ORMInterface $orm) use ($role) |
|
83 | + { |
|
78 | 84 | return $orm->getRepository($role); |
79 | 85 | }); |
80 | 86 | } |
@@ -104,7 +110,8 @@ discard block |
||
104 | 110 | ): ORMInterface { |
105 | 111 | $orm = new ORM($factory, $schema); |
106 | 112 | |
107 | - if ($promiseFactory !== null) { |
|
113 | + if ($promiseFactory !== null) |
|
114 | + { |
|
108 | 115 | return $orm->withPromiseFactory($promiseFactory); |
109 | 116 | } |
110 | 117 |