Passed
Pull Request — master (#9)
by Mariusz
02:39
created

draft-1.php (1 issue)

Labels
Severity
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
19
// Need to specify strategy for final objects - if they should be fully loaded or if proxies are enough.
20
21
22
$doctrineOrmAssociationPath = $doctrineOrmAssociationPathBuilder
23
    ->associate('bar')
24
        ->aliasAs('bars')
25
        ->loadFull()
26
    ->associate('baz')
27
        ->aliasAs('bazs')
28
    ->create();
29
30
$doctrineOrmAssociationPath = $doctrineOrmAssociationPathBuilder
31
    ->associate('bar')
32
    ->associate('baz')
33
    ->create();
34
35
// Equivalent to
36
$doctrineOrmAssociationPath = new DoctrineOrmAssociationPath([
37
    (new DoctrineOrmAssociation('bar'))
38
        ->setAlias('bars')
39
        ->setLoadMode(DoctrineOrmAssociationLoad::FULL),
40
    (new DoctrineOrmAssociation('baz'))
41
        ->setLoadMode(DoctrineOrmAssociationLoad::PROXY),
42
]);
43
44
$doctrineOrmEntitiesSource = (new DoctrineOrmEntitiesSource([$foo1, $foo2, $foo3]))
45
    ->declareEntityClass(Foo::class);
46
47
$targets = $associate
48
    ->getAdapter('doctrine')
49
    ->getTargets($doctrineOrmEntitiesSource, $doctrineOrmAssociationPath)
50
51
$bazs = $targets->getAll();
0 ignored issues
show
A parse error occurred: Syntax error, unexpected T_VARIABLE on line 51 at column 0
Loading history...
52