@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function boot(Container $container, FinalizerInterface $finalizer, SchemaInterface $schema = null): void |
| 53 | 53 | { |
| 54 | 54 | $finalizer->addFinalizer(function () use ($container): void { |
| 55 | - if ($container->hasInstance(ORMInterface::class)) { |
|
| 55 | + if ($container->hasInstance(ORMInterface::class)){ |
|
| 56 | 56 | $container->get(ORMInterface::class)->getHeap()->clean(); |
| 57 | 57 | } |
| 58 | 58 | }); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | ): ORMInterface { |
| 74 | 74 | $orm = new ORM($factory, $schema); |
| 75 | 75 | |
| 76 | - if ($promiseFactory !== null) { |
|
| 76 | + if ($promiseFactory !== null){ |
|
| 77 | 77 | return $orm->withPromiseFactory($promiseFactory); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -52,7 +52,8 @@ discard block |
||
| 52 | 52 | public function boot(Container $container, FinalizerInterface $finalizer, SchemaInterface $schema = null): void |
| 53 | 53 | { |
| 54 | 54 | $finalizer->addFinalizer(function () use ($container): void { |
| 55 | - if ($container->hasInstance(ORMInterface::class)) { |
|
| 55 | + if ($container->hasInstance(ORMInterface::class)) |
|
| 56 | + { |
|
| 56 | 57 | $container->get(ORMInterface::class)->getHeap()->clean(); |
| 57 | 58 | } |
| 58 | 59 | }); |
@@ -73,7 +74,8 @@ discard block |
||
| 73 | 74 | ): ORMInterface { |
| 74 | 75 | $orm = new ORM($factory, $schema); |
| 75 | 76 | |
| 76 | - if ($promiseFactory !== null) { |
|
| 77 | + if ($promiseFactory !== null) |
|
| 78 | + { |
|
| 77 | 79 | return $orm->withPromiseFactory($promiseFactory); |
| 78 | 80 | } |
| 79 | 81 | |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | public function getGenerators(): array |
| 86 | 86 | { |
| 87 | 87 | $result = []; |
| 88 | - foreach ($this->generators as $group) { |
|
| 89 | - foreach ($group as $generator) { |
|
| 90 | - if (is_object($generator) && !$generator instanceof Container\Autowire) { |
|
| 88 | + foreach ($this->generators as $group){ |
|
| 89 | + foreach ($group as $generator){ |
|
| 90 | + if (is_object($generator) && !$generator instanceof Container\Autowire){ |
|
| 91 | 91 | $result[] = $generator; |
| 92 | - } else { |
|
| 92 | + }else{ |
|
| 93 | 93 | $result[] = $this->container->get($generator); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | protected function schema(MemoryInterface $memory): SchemaInterface |
| 106 | 106 | { |
| 107 | 107 | $schema = $memory->loadData('cycle'); |
| 108 | - if (is_null($schema)) { |
|
| 108 | + if (is_null($schema)){ |
|
| 109 | 109 | $schema = (new Compiler())->compile( |
| 110 | 110 | $this->container->get(Registry::class), |
| 111 | 111 | $this->getGenerators() |
@@ -85,11 +85,16 @@ discard block |
||
| 85 | 85 | public function getGenerators(): array |
| 86 | 86 | { |
| 87 | 87 | $result = []; |
| 88 | - foreach ($this->generators as $group) { |
|
| 89 | - foreach ($group as $generator) { |
|
| 90 | - if (is_object($generator) && !$generator instanceof Container\Autowire) { |
|
| 88 | + foreach ($this->generators as $group) |
|
| 89 | + { |
|
| 90 | + foreach ($group as $generator) |
|
| 91 | + { |
|
| 92 | + if (is_object($generator) && !$generator instanceof Container\Autowire) |
|
| 93 | + { |
|
| 91 | 94 | $result[] = $generator; |
| 92 | - } else { |
|
| 95 | + } |
|
| 96 | + else |
|
| 97 | + { |
|
| 93 | 98 | $result[] = $this->container->get($generator); |
| 94 | 99 | } |
| 95 | 100 | } |
@@ -105,7 +110,8 @@ discard block |
||
| 105 | 110 | protected function schema(MemoryInterface $memory): SchemaInterface |
| 106 | 111 | { |
| 107 | 112 | $schema = $memory->loadData('cycle'); |
| 108 | - if (is_null($schema)) { |
|
| 113 | + if (is_null($schema)) |
|
| 114 | + { |
|
| 109 | 115 | $schema = (new Compiler())->compile( |
| 110 | 116 | $this->container->get(Registry::class), |
| 111 | 117 | $this->getGenerators() |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $this->orm = $orm; |
| 34 | 34 | |
| 35 | - foreach ($orm->getSchema()->getRoles() as $role) { |
|
| 35 | + foreach ($orm->getSchema()->getRoles() as $role){ |
|
| 36 | 36 | $repository = $orm->getSchema()->define($role, Schema::REPOSITORY); |
| 37 | - if ($repository !== Select\Repository::class && $repository !== null) { |
|
| 37 | + if ($repository !== Select\Repository::class && $repository !== null){ |
|
| 38 | 38 | $this->mapping[$repository] = $role; |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function createInjection(\ReflectionClass $class, string $context = null) |
| 49 | 49 | { |
| 50 | - if (!isset($this->mapping[$class->getName()])) { |
|
| 50 | + if (!isset($this->mapping[$class->getName()])){ |
|
| 51 | 51 | throw new ORMException("Unable to find Entity role for repository {$class->getName()}"); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -32,9 +32,11 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $this->orm = $orm; |
| 34 | 34 | |
| 35 | - foreach ($orm->getSchema()->getRoles() as $role) { |
|
| 35 | + foreach ($orm->getSchema()->getRoles() as $role) |
|
| 36 | + { |
|
| 36 | 37 | $repository = $orm->getSchema()->define($role, Schema::REPOSITORY); |
| 37 | - if ($repository !== Select\Repository::class && $repository !== null) { |
|
| 38 | + if ($repository !== Select\Repository::class && $repository !== null) |
|
| 39 | + { |
|
| 38 | 40 | $this->mapping[$repository] = $role; |
| 39 | 41 | } |
| 40 | 42 | } |
@@ -47,7 +49,8 @@ discard block |
||
| 47 | 49 | */ |
| 48 | 50 | public function createInjection(\ReflectionClass $class, string $context = null) |
| 49 | 51 | { |
| 50 | - if (!isset($this->mapping[$class->getName()])) { |
|
| 52 | + if (!isset($this->mapping[$class->getName()])) |
|
| 53 | + { |
|
| 51 | 54 | throw new ORMException("Unable to find Entity role for repository {$class->getName()}"); |
| 52 | 55 | } |
| 53 | 56 | |