xsolve-pl /
xsolve-associate
| 1 | <?php |
||
| 2 | |||
| 3 | $sources = [$source1, $source2, $source3]; |
||
| 4 | $path = ['bar', 'baz']; |
||
| 5 | |||
| 6 | $targets = $collector->getTargets($sources, $path); |
||
| 7 | |||
| 8 | $sourcesToTargetsMap = $collector->getSourcesToTargetsMap($sources, $path); |
||
| 9 | $targets1 = $sourcesToTargetsMap->get([$source1]); |
||
| 10 | $targets1And2 = $sourcesToTargetsMap->get([$source1, $source2]); |
||
| 11 | |||
| 12 | $targetIds = $collector->getTargetIds($sources, $path); |
||
| 13 | |||
| 14 | $sourcesToTargetIdsMap = $collector->getSourcesToTargetIdsMap($sources, $path); |
||
| 15 | $targetIds1 = $sourcesToTargetIdsMap->get([$source1]); |
||
| 16 | $targetIds1And2 = $sourcesToTargetIdsMap->get([$source1, $source2]); |
||
| 17 | |||
| 18 | // Need to specify strategy for final objects - if they should be fully loaded or if proxies are enough. |
||
| 19 | |||
| 20 | $doctrineOrmAssociationPath = $doctrineOrmAssociationPathBuilder |
||
| 21 | ->associate('bar') |
||
| 22 | ->aliasAs('bars') |
||
| 23 | ->loadFull() |
||
| 24 | ->associate('baz') |
||
| 25 | ->aliasAs('bazs') |
||
| 26 | ->create(); |
||
| 27 | |||
| 28 | $doctrineOrmAssociationPath = $doctrineOrmAssociationPathBuilder |
||
| 29 | ->associate('bar') |
||
| 30 | ->associate('baz') |
||
| 31 | ->create(); |
||
| 32 | |||
| 33 | // Equivalent to |
||
| 34 | $doctrineOrmAssociationPath = new DoctrineOrmAssociationPath([ |
||
|
0 ignored issues
–
show
|
|||
| 35 | (new DoctrineOrmAssociation('bar')) |
||
|
0 ignored issues
–
show
The type
DoctrineOrmAssociation was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 36 | ->setAlias('bars') |
||
| 37 | ->setLoadMode(DoctrineOrmAssociationLoad::FULL), |
||
|
0 ignored issues
–
show
The type
DoctrineOrmAssociationLoad was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 38 | (new DoctrineOrmAssociation('baz')) |
||
| 39 | ->setLoadMode(DoctrineOrmAssociationLoad::PROXY), |
||
| 40 | ]); |
||
| 41 | |||
| 42 | $doctrineOrmEntitiesSource = (new DoctrineOrmEntitiesSource([$foo1, $foo2, $foo3])) |
||
|
0 ignored issues
–
show
The type
DoctrineOrmEntitiesSource was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 43 | ->declareEntityClass(Foo::class); |
||
| 44 | |||
| 45 | $targets = $associate |
||
| 46 | ->getAdapter('doctrine') |
||
| 47 | ->getTargets($doctrineOrmEntitiesSource, $doctrineOrmAssociationPath); |
||
| 48 | |||
| 49 | $bazs = $targets->getAll(); |
||
| 50 | |||
| 51 | // Complete usage for prefetching with simplified facad, diverging paths. |
||
| 52 | $associateDoctrineOrmFetcher->fetch( |
||
| 53 | $foos, |
||
| 54 | Foo::class, |
||
| 55 | [ |
||
| 56 | ['foo', [ |
||
| 57 | ['bar'], |
||
| 58 | ['baz' , 'qux'], |
||
| 59 | ]], |
||
| 60 | ['qux'], |
||
| 61 | ] |
||
| 62 | ); |
||
| 63 | |||
| 64 | |||
| 65 | // .foo.bar |
||
| 66 | // .baz.qux |
||
| 67 | // .qux |
||
| 68 | // |
||
| 69 | $doctrineOrmAssociationPathBuilder |
||
| 70 | ->diverge() |
||
| 71 | ->associate('foo') |
||
| 72 | ->diverge() |
||
| 73 | ->associate('bar') |
||
| 74 | ->endDiverge() |
||
| 75 | ->diverge() |
||
| 76 | ->associate('baz') |
||
| 77 | ->associate('qux') |
||
| 78 | ->endDiverge() |
||
| 79 | ->endDiverge() |
||
| 80 | ->diverge() |
||
| 81 | ->associate('qux') |
||
| 82 | ->endDiverge(); |
||
| 83 | |||
| 84 | // .foo.bar.baz.qux |
||
| 85 | // .qux |
||
| 86 | // |
||
| 87 | $doctrineOrmAssociationPathBuilder |
||
| 88 | ->associate('foo') |
||
| 89 | ->associate('bar') |
||
| 90 | ->diverge() |
||
| 91 | ->associate('baz') |
||
| 92 | ->associate('qux') |
||
| 93 | ->endDiverge() |
||
| 94 | ->diverge() |
||
| 95 | ->associate('qux') |
||
| 96 | ->endDiverge(); |
||
| 97 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths