doctrine / DoctrineORMModule

Compare d9b473d ... +138 ... d289b90

Showing 32 of 131 files from the diff.
Newly tracked file
src/Module.php changed.
Other files ignored by Codecov
LICENSE has changed.
phpcs.xml has changed.
.gitignore has changed.
phpunit.xml.dist has changed.
docs/en/cache.rst has changed.
README.md has changed.
src/autoload.php was deleted.
build/.gitignore was deleted.
.travis.yml was deleted.
UPGRADE.md was deleted.
psalm.xml is new.
ci/run-cli.sh has changed.
tests/config.php has changed.
.gitattributes has changed.
composer.json has changed.
composer.lock was deleted.
docs/index.rst was deleted.

@@ -4,23 +4,24 @@
Loading
4 4
5 5
namespace DoctrineORMModule\Service;
6 6
7 -
use Doctrine\Common\EventSubscriber;
8 -
use Doctrine\ORM\Events;
9 7
use Doctrine\ORM\Tools\ResolveTargetEntityListener;
10 8
use DoctrineModule\Service\AbstractFactory;
11 9
use DoctrineORMModule\Options\EntityResolver;
12 10
use Interop\Container\ContainerInterface;
13 11
use Laminas\EventManager\EventManager;
14 12
use Laminas\ServiceManager\ServiceLocatorInterface;
15 13
14 +
use function assert;
15 +
16 16
class EntityResolverFactory extends AbstractFactory
17 17
{
18 18
    /**
19 19
     * {@inheritDoc}
20 20
     */
21 21
    public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
22 22
    {
23 -
        $options      = $this->getOptions($container, 'entity_resolver');
23 +
        $options = $this->getOptions($container, 'entity_resolver');
24 +
        assert($options instanceof EntityResolver);
24 25
        $eventManager = $container->get($options->getEventManager());
25 26
        $resolvers    = $options->getResolvers();
26 27
@@ -30,18 +31,15 @@
Loading
30 31
            $targetEntityListener->addResolveTargetEntity($oldEntity, $newEntity, []);
31 32
        }
32 33
33 -
        // Starting from Doctrine ORM 2.5, the listener implements EventSubscriber
34 -
        if ($targetEntityListener instanceof EventSubscriber) {
35 -
            $eventManager->addEventSubscriber($targetEntityListener);
36 -
        } else {
37 -
            $eventManager->addEventListener(Events::loadClassMetadata, $targetEntityListener);
38 -
        }
34 +
        $eventManager->addEventSubscriber($targetEntityListener);
39 35
40 36
        return $eventManager;
41 37
    }
42 38
43 39
    /**
44 40
     * {@inheritDoc}
41 +
     *
42 +
     * @deprecated 4.1.0 With laminas-servicemanager v3 this method is obsolete and will be removed in 5.0.0.
45 43
     */
46 44
    public function createService(ServiceLocatorInterface $container)
47 45
    {
@@ -51,7 +49,7 @@
Loading
51 49
    /**
52 50
     * Get the class name of the options associated with this factory.
53 51
     */
54 -
    public function getOptionsClass() : string
52 +
    public function getOptionsClass(): string
55 53
    {
56 54
        return EntityResolver::class;
57 55
    }

@@ -20,9 +20,9 @@
Loading
20 20
     *
21 21
     * @return ObjectRadio
22 22
     */
23 -
    public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
23 +
    public function __invoke(ContainerInterface $serviceLocator, $requestedName, ?array $options = null)
24 24
    {
25 -
        $entityManager = $container->get(EntityManager::class);
25 +
        $entityManager = $serviceLocator->get(EntityManager::class);
26 26
        $element       = new ObjectRadio();
27 27
28 28
        $element->getProxy()->setObjectManager($entityManager);
@@ -32,9 +32,11 @@
Loading
32 32
33 33
    /**
34 34
     * {@inheritDoc}
35 +
     *
36 +
     * @deprecated 4.1.0 With laminas-servicemanager v3 this method is obsolete and will be removed in 5.0.0.
35 37
     */
36 -
    public function createService(ServiceLocatorInterface $container)
38 +
    public function createService(ServiceLocatorInterface $serviceLocator)
37 39
    {
38 -
        return $this($container->getServiceLocator(), ObjectRadio::class);
40 +
        return $this($serviceLocator, ObjectRadio::class);
39 41
    }
40 42
}

@@ -10,6 +10,7 @@
Loading
10 10
use Laminas\ModuleManager\Feature\ControllerProviderInterface;
11 11
use Laminas\ModuleManager\Feature\DependencyIndicatorInterface;
12 12
use Laminas\ModuleManager\ModuleManagerInterface;
13 +
13 14
use function class_exists;
14 15
15 16
/**
@@ -32,7 +33,7 @@
Loading
32 33
            ->attach(
33 34
                'doctrine',
34 35
                'loadCli.post',
35 -
                static function (EventInterface $event) : void {
36 +
                static function (EventInterface $event): void {
36 37
                    $event
37 38
                        ->getParam('ServiceManager')
38 39
                        ->get(CliConfigurator::class)
@@ -50,7 +51,7 @@
Loading
50 51
            ->getEventManager()
51 52
            ->attach(
52 53
                ProfilerEvent::EVENT_PROFILER_INIT,
53 -
                static function ($event) : void {
54 +
                static function ($event): void {
54 55
                    $container = $event->getTarget()->getParam('ServiceManager');
55 56
                    $container->get('doctrine.sql_logger_collector.orm_default');
56 57
                }
@@ -62,15 +63,15 @@
Loading
62 63
     */
63 64
    public function getConfig()
64 65
    {
65 -
        return include __DIR__ . '/../../config/module.config.php';
66 +
        return include __DIR__ . '/../config/module.config.php';
66 67
    }
67 68
68 69
    /**
69 70
     * {@inheritDoc}
70 71
     */
71 72
    public function getControllerConfig()
72 73
    {
73 -
        return include __DIR__ . '/../../config/controllers.config.php';
74 +
        return include __DIR__ . '/../config/controllers.config.php';
74 75
    }
75 76
76 77
    /**

@@ -9,6 +9,7 @@
Loading
9 9
use Doctrine\ORM\Mapping\QuoteStrategy;
10 10
use Doctrine\ORM\Repository\RepositoryFactory;
11 11
use Laminas\Stdlib\Exception\InvalidArgumentException;
12 +
12 13
use function get_class;
13 14
use function gettype;
14 15
use function is_object;
@@ -216,7 +217,7 @@
Loading
216 217
    /**
217 218
     * @param mixed[] $datetimeFunctions
218 219
     */
219 -
    public function setDatetimeFunctions(array $datetimeFunctions) : self
220 +
    public function setDatetimeFunctions(array $datetimeFunctions): self
220 221
    {
221 222
        $this->datetimeFunctions = $datetimeFunctions;
222 223
@@ -226,27 +227,27 @@
Loading
226 227
    /**
227 228
     * @return mixed[]
228 229
     */
229 -
    public function getDatetimeFunctions() : array
230 +
    public function getDatetimeFunctions(): array
230 231
    {
231 232
        return $this->datetimeFunctions;
232 233
    }
233 234
234 -
    public function setDriver(string $driver) : self
235 +
    public function setDriver(string $driver): self
235 236
    {
236 237
        $this->driver = $driver;
237 238
238 239
        return $this;
239 240
    }
240 241
241 -
    public function getDriver() : string
242 +
    public function getDriver(): string
242 243
    {
243 244
        return 'doctrine.driver.' . $this->driver;
244 245
    }
245 246
246 247
    /**
247 248
     * @param mixed[] $entityNamespaces
248 249
     */
249 -
    public function setEntityNamespaces(array $entityNamespaces) : self
250 +
    public function setEntityNamespaces(array $entityNamespaces): self
250 251
    {
251 252
        $this->entityNamespaces = $entityNamespaces;
252 253
@@ -256,61 +257,61 @@
Loading
256 257
    /**
257 258
     * @return mixed[]
258 259
     */
259 -
    public function getEntityNamespaces() : array
260 +
    public function getEntityNamespaces(): array
260 261
    {
261 262
        return $this->entityNamespaces;
262 263
    }
263 264
264 -
    public function setGenerateProxies(bool $generateProxies) : self
265 +
    public function setGenerateProxies(bool $generateProxies): self
265 266
    {
266 267
        $this->generateProxies = $generateProxies;
267 268
268 269
        return $this;
269 270
    }
270 271
271 -
    public function getGenerateProxies() : bool
272 +
    public function getGenerateProxies(): bool
272 273
    {
273 274
        return $this->generateProxies;
274 275
    }
275 276
276 -
    public function setMetadataCache(string $metadataCache) : self
277 +
    public function setMetadataCache(string $metadataCache): self
277 278
    {
278 279
        $this->metadataCache = $metadataCache;
279 280
280 281
        return $this;
281 282
    }
282 283
283 -
    public function getMetadataCache() : string
284 +
    public function getMetadataCache(): string
284 285
    {
285 286
        return 'doctrine.cache.' . $this->metadataCache;
286 287
    }
287 288
288 -
    public function setResultCache(string $resultCache) : void
289 +
    public function setResultCache(string $resultCache): void
289 290
    {
290 291
        $this->resultCache = $resultCache;
291 292
    }
292 293
293 -
    public function getResultCache() : string
294 +
    public function getResultCache(): string
294 295
    {
295 296
        return 'doctrine.cache.' . $this->resultCache;
296 297
    }
297 298
298 -
    public function setHydrationCache(string $hydrationCache) : self
299 +
    public function setHydrationCache(string $hydrationCache): self
299 300
    {
300 301
        $this->hydrationCache = $hydrationCache;
301 302
302 303
        return $this;
303 304
    }
304 305
305 -
    public function getHydrationCache() : string
306 +
    public function getHydrationCache(): string
306 307
    {
307 308
        return 'doctrine.cache.' . $this->hydrationCache;
308 309
    }
309 310
310 311
    /**
311 312
     * @param mixed[] $namedNativeQueries
312 313
     */
313 -
    public function setNamedNativeQueries(array $namedNativeQueries) : self
314 +
    public function setNamedNativeQueries(array $namedNativeQueries): self
314 315
    {
315 316
        $this->namedNativeQueries = $namedNativeQueries;
316 317
@@ -320,15 +321,15 @@
Loading
320 321
    /**
321 322
     * @return mixed[]
322 323
     */
323 -
    public function getNamedNativeQueries() : array
324 +
    public function getNamedNativeQueries(): array
324 325
    {
325 326
        return $this->namedNativeQueries;
326 327
    }
327 328
328 329
    /**
329 330
     * @param mixed[] $namedQueries
330 331
     */
331 -
    public function setNamedQueries(array $namedQueries) : self
332 +
    public function setNamedQueries(array $namedQueries): self
332 333
    {
333 334
        $this->namedQueries = $namedQueries;
334 335
@@ -338,15 +339,15 @@
Loading
338 339
    /**
339 340
     * @return mixed[]
340 341
     */
341 -
    public function getNamedQueries() : array
342 +
    public function getNamedQueries(): array
342 343
    {
343 344
        return $this->namedQueries;
344 345
    }
345 346
346 347
    /**
347 348
     * @param  mixed[] $numericFunctions
348 349
     */
349 -
    public function setNumericFunctions(array $numericFunctions) : self
350 +
    public function setNumericFunctions(array $numericFunctions): self
350 351
    {
351 352
        $this->numericFunctions = $numericFunctions;
352 353
@@ -356,15 +357,15 @@
Loading
356 357
    /**
357 358
     * @return mixed[]
358 359
     */
359 -
    public function getNumericFunctions() : array
360 +
    public function getNumericFunctions(): array
360 361
    {
361 362
        return $this->numericFunctions;
362 363
    }
363 364
364 365
    /**
365 366
     * @param mixed[] $filters
366 367
     */
367 -
    public function setFilters(array $filters) : self
368 +
    public function setFilters(array $filters): self
368 369
    {
369 370
        $this->filters = $filters;
370 371
@@ -374,51 +375,51 @@
Loading
374 375
    /**
375 376
     * @return mixed[]
376 377
     */
377 -
    public function getFilters() : array
378 +
    public function getFilters(): array
378 379
    {
379 380
        return $this->filters;
380 381
    }
381 382
382 -
    public function setProxyDir(string $proxyDir) : self
383 +
    public function setProxyDir(string $proxyDir): self
383 384
    {
384 385
        $this->proxyDir = $proxyDir;
385 386
386 387
        return $this;
387 388
    }
388 389
389 -
    public function getProxyDir() : string
390 +
    public function getProxyDir(): string
390 391
    {
391 392
        return $this->proxyDir;
392 393
    }
393 394
394 -
    public function setProxyNamespace(string $proxyNamespace) : self
395 +
    public function setProxyNamespace(string $proxyNamespace): self
395 396
    {
396 397
        $this->proxyNamespace = $proxyNamespace;
397 398
398 399
        return $this;
399 400
    }
400 401
401 -
    public function getProxyNamespace() : string
402 +
    public function getProxyNamespace(): string
402 403
    {
403 404
        return $this->proxyNamespace;
404 405
    }
405 406
406 -
    public function setQueryCache(string $queryCache) : self
407 +
    public function setQueryCache(string $queryCache): self
407 408
    {
408 409
        $this->queryCache = $queryCache;
409 410
410 411
        return $this;
411 412
    }
412 413
413 -
    public function getQueryCache() : string
414 +
    public function getQueryCache(): string
414 415
    {
415 416
        return 'doctrine.cache.' . $this->queryCache;
416 417
    }
417 418
418 419
    /**
419 420
     * @param  mixed[] $stringFunctions
420 421
     */
421 -
    public function setStringFunctions(array $stringFunctions) : self
422 +
    public function setStringFunctions(array $stringFunctions): self
422 423
    {
423 424
        $this->stringFunctions = $stringFunctions;
424 425
@@ -428,15 +429,15 @@
Loading
428 429
    /**
429 430
     * @return mixed[]
430 431
     */
431 -
    public function getStringFunctions() : array
432 +
    public function getStringFunctions(): array
432 433
    {
433 434
        return $this->stringFunctions;
434 435
    }
435 436
436 437
    /**
437 438
     * @param mixed[] $modes
438 439
     */
439 -
    public function setCustomHydrationModes(array $modes) : self
440 +
    public function setCustomHydrationModes(array $modes): self
440 441
    {
441 442
        $this->customHydrationModes = $modes;
442 443
@@ -446,7 +447,7 @@
Loading
446 447
    /**
447 448
     * @return mixed[]
448 449
     */
449 -
    public function getCustomHydrationModes() : array
450 +
    public function getCustomHydrationModes(): array
450 451
    {
451 452
        return $this->customHydrationModes;
452 453
    }
@@ -456,9 +457,10 @@
Loading
456 457
     *
457 458
     * @throws InvalidArgumentException   when the provided naming strategy does not fit the expected type.
458 459
     */
459 -
    public function setNamingStrategy($namingStrategy) : self
460 +
    public function setNamingStrategy($namingStrategy): self
460 461
    {
461 -
        if ($namingStrategy === null
462 +
        if (
463 +
            $namingStrategy === null
462 464
            || is_string($namingStrategy)
463 465
            || $namingStrategy instanceof NamingStrategy
464 466
        ) {
@@ -489,9 +491,10 @@
Loading
489 491
     *
490 492
     * @throws InvalidArgumentException   when the provided quote strategy does not fit the expected type.
491 493
     */
492 -
    public function setQuoteStrategy($quoteStrategy) : self
494 +
    public function setQuoteStrategy($quoteStrategy): self
493 495
    {
494 -
        if ($quoteStrategy === null
496 +
        if (
497 +
            $quoteStrategy === null
495 498
            || is_string($quoteStrategy)
496 499
            || $quoteStrategy instanceof QuoteStrategy
497 500
        ) {
@@ -522,9 +525,10 @@
Loading
522 525
     *
523 526
     * @throws InvalidArgumentException   when the provided repository factory does not fit the expected type.
524 527
     */
525 -
    public function setRepositoryFactory($repositoryFactory) : self
528 +
    public function setRepositoryFactory($repositoryFactory): self
526 529
    {
527 -
        if ($repositoryFactory === null
530 +
        if (
531 +
            $repositoryFactory === null
528 532
            || is_string($repositoryFactory)
529 533
            || $repositoryFactory instanceof RepositoryFactory
530 534
        ) {
@@ -555,14 +559,14 @@
Loading
555 559
     *
556 560
     * @see \Doctrine\ORM\Configuration::setClassMetadataFactoryName()
557 561
     */
558 -
    public function setClassMetadataFactoryName(string $factoryName) : self
562 +
    public function setClassMetadataFactoryName(string $factoryName): self
559 563
    {
560 564
        $this->classMetadataFactoryName = (string) $factoryName;
561 565
562 566
        return $this;
563 567
    }
564 568
565 -
    public function getClassMetadataFactoryName() : ?string
569 +
    public function getClassMetadataFactoryName(): ?string
566 570
    {
567 571
        return $this->classMetadataFactoryName;
568 572
    }
@@ -573,9 +577,10 @@
Loading
573 577
     * @throws InvalidArgumentException           When the provided entity listener resolver
574 578
     *                                            does not fit the expected type.
575 579
     */
576 -
    public function setEntityListenerResolver($entityListenerResolver) : self
580 +
    public function setEntityListenerResolver($entityListenerResolver): self
577 581
    {
578 -
        if ($entityListenerResolver === null
582 +
        if (
583 +
            $entityListenerResolver === null
579 584
            || $entityListenerResolver instanceof EntityListenerResolver
580 585
            || is_string($entityListenerResolver)
581 586
        ) {
@@ -602,34 +607,34 @@
Loading
602 607
    /**
603 608
     * @param  mixed[] $secondLevelCache
604 609
     */
605 -
    public function setSecondLevelCache(array $secondLevelCache) : self
610 +
    public function setSecondLevelCache(array $secondLevelCache): self
606 611
    {
607 612
        $this->secondLevelCache = new SecondLevelCacheConfiguration($secondLevelCache);
608 613
609 614
        return $this;
610 615
    }
611 616
612 -
    public function getSecondLevelCache() : SecondLevelCacheConfiguration
617 +
    public function getSecondLevelCache(): SecondLevelCacheConfiguration
613 618
    {
614 619
        return $this->secondLevelCache ?: new SecondLevelCacheConfiguration();
615 620
    }
616 621
617 -
    public function setFilterSchemaAssetsExpression(string $filterSchemaAssetsExpression) : self
622 +
    public function setFilterSchemaAssetsExpression(string $filterSchemaAssetsExpression): self
618 623
    {
619 624
        $this->filterSchemaAssetsExpression = $filterSchemaAssetsExpression;
620 625
621 626
        return $this;
622 627
    }
623 628
624 -
    public function getFilterSchemaAssetsExpression() : ?string
629 +
    public function getFilterSchemaAssetsExpression(): ?string
625 630
    {
626 631
        return $this->filterSchemaAssetsExpression;
627 632
    }
628 633
629 634
    /**
630 635
     * Sets default repository class.
631 636
     */
632 -
    public function setDefaultRepositoryClassName(string $className) : self
637 +
    public function setDefaultRepositoryClassName(string $className): self
633 638
    {
634 639
        $this->defaultRepositoryClassName = (string) $className;
635 640
@@ -639,7 +644,7 @@
Loading
639 644
    /**
640 645
     * Get default repository class name.
641 646
     */
642 -
    public function getDefaultRepositoryClassName() : ?string
647 +
    public function getDefaultRepositoryClassName(): ?string
643 648
    {
644 649
        return $this->defaultRepositoryClassName;
645 650
    }

@@ -22,21 +22,22 @@
Loading
22 22
     *
23 23
     * @return EntityManager
24 24
     */
25 -
    public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
25 +
    public function __invoke(ContainerInterface $serviceLocator, $requestedName, ?array $options = null)
26 26
    {
27 -
        return $container->get('doctrine.entitymanager.orm_default');
27 +
        return $serviceLocator->get('doctrine.entitymanager.orm_default');
28 28
    }
29 29
30 30
    /**
31 31
     * {@inheritDoc}
32 32
     *
33 33
     * @deprecated this method was introduced to allow aliasing of service `Doctrine\ORM\EntityManager`
34 34
     *             from `doctrine.entitymanager.orm_default`
35 +
     * @deprecated 4.1.0 With laminas-servicemanager v3 this method is obsolete and will be removed in 5.0.0.
35 36
     *
36 37
     * @return EntityManager
37 38
     */
38 -
    public function createService(ServiceLocatorInterface $container)
39 +
    public function createService(ServiceLocatorInterface $serviceLocator)
39 40
    {
40 -
        return $this($container, EntityManager::class);
41 +
        return $this($serviceLocator, EntityManager::class);
41 42
    }
42 43
}

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Learn more Showing 11 files with coverage changes found.

Changes in src/Options/Configuration.php
-4
Loading file...
New file src/Service/CliConfiguratorFactory.php
New
Loading file...
New file src/Service/RunSqlCommandFactory.php
New
Loading file...
New file src/Service/ReservedWordsCommandFactory.php
New
Loading file...
New file src/Service/MigrationsCommandFactory.php
New
Loading file...
New file src/Service/DoctrineObjectHydratorFactory.php
New
Loading file...
Changes in src/Service/DBALConfigurationFactory.php
-1
Loading file...
Changes in src/CliConfigurator.php
-1
+1
Loading file...
Changes in src/Service/SQLLoggerCollectorFactory.php
-1
Loading file...
Changes in src/Options/EntityResolver.php
-1
Loading file...
Changes in src/Paginator/Adapter/DoctrinePaginator.php
-8
+8
Loading file...

140 Commits

Hiding 1 contexual commits
-1
-1
Hiding 1 contexual commits
+1
+1
-1
-1
Hiding 4 contexual commits
+7
+5
+2
Hiding 2 contexual commits Hiding 2 contexual commits
+1
-1
+1
-1
Hiding 2 contexual commits
+1 Files
+9
+6
+3
-1
+1
+1
-1
Hiding 2 contexual commits
+5
+46
-41
-5
-46
+41
-1
+1
+1
-1
+1
+1
-1
-1
-1
+1
+5
+46
-41
-5
-45
+40
Hiding 2 contexual commits
+1
+1
-1
-1
Hiding 1 contexual commits
+7
+18
-11
Hiding 5 contexual commits
-1
+1
Hiding 1 contexual commits
+1
-1
Hiding 4 contexual commits
-3 Files
-271
-258
-13
Hiding 4 contexual commits
-4
-3
-1
Hiding 2 contexual commits
+1 Files
+7
+6
+1
-1
+1
+28
-28
-28
+28
+7
+7
Hiding 3 contexual commits
+1
+21
-20
Hiding 3 contexual commits
-9
-27
+18
-3 Files
-54
+26
-80
Hiding 6 contexual commits
+6
+1
+5
Hiding 15 contexual commits
+1 Files
+16
-25
+41
Hiding 2 contexual commits
Hiding 1 contexual commits
+1
+1
Hiding 2 contexual commits
Hiding 3 contexual commits
Files Coverage
src 0.99% 84.06%
Project Totals (32 files) 84.06%
Loading