• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

api-platform / core / 17158226138

22 Aug 2025 02:38PM UTC coverage: 22.203% (-0.006%) from 22.209%
17158226138

Pull #7303

github

web-flow
Merge d35038aad into 9e382e01b
Pull Request #7303: fix(test): replace `Collection|iterable` with `Collection` and add appropriate PHPDoc tags

0 of 20 new or added lines in 8 files covered. (0.0%)

7 existing lines in 7 files now uncovered.

11699 of 52692 relevant lines covered (22.2%)

24.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Doctrine/Odm/Tests/Fixtures/Document/RelatedDummy.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Doctrine\Odm\Tests\Fixtures\Document;
15

16
use Doctrine\Common\Collections\ArrayCollection;
17
use Doctrine\Common\Collections\Collection;
18
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
19

20
/**
21
 * Related Dummy.
22
 *
23
 * @author Kévin Dunglas <dunglas@gmail.com>
24
 * @author Alexandre Delplace <alexandre.delplacemille@gmail.com>
25
 */
26
#[ODM\Document]
27
class RelatedDummy extends ParentDummy implements \Stringable
28
{
29
    #[ODM\Id(strategy: 'INCREMENT', type: 'int')]
30
    private $id;
31
    /**
32
     * @var string A name
33
     */
34
    #[ODM\Field(type: 'string', nullable: true)]
35
    public $name;
36
    #[ODM\Field(type: 'string')]
37
    protected $symfony = 'symfony';
38
    /**
39
     * @var \DateTime A dummy date
40
     */
41
    #[ODM\Field(type: 'date', nullable: true)]
42
    public $dummyDate;
43
    #[ODM\ReferenceOne(targetDocument: ThirdLevel::class, cascade: ['persist'], nullable: true, storeAs: 'id', inversedBy: 'relatedDummies')]
44
    public ?ThirdLevel $thirdLevel = null;
45
    /**
46
     * @var Collection<int, RelatedToDummyFriend>|iterable
47
     */
48
    #[ODM\ReferenceMany(targetDocument: RelatedToDummyFriend::class, cascade: ['persist'], mappedBy: 'relatedDummy', storeAs: 'id')]
49
    public Collection|iterable $relatedToDummyFriend;
50
    #[ODM\Field(type: 'bool')]
51
    public ?bool $dummyBoolean = null;
52
    #[ODM\EmbedOne(targetDocument: EmbeddableDummy::class)]
53
    public ?EmbeddableDummy $embeddedDummy = null;
54

55
    public function __construct()
56
    {
57
        $this->relatedToDummyFriend = new ArrayCollection();
×
58
        $this->embeddedDummy = new EmbeddableDummy();
×
59
    }
60

61
    public function getId()
62
    {
63
        return $this->id;
×
64
    }
65

66
    public function setId($id): void
67
    {
68
        $this->id = $id;
×
69
    }
70

71
    public function setName($name): void
72
    {
73
        $this->name = $name;
×
74
    }
75

76
    public function getName()
77
    {
78
        return $this->name;
×
79
    }
80

81
    public function getSymfony()
82
    {
83
        return $this->symfony;
×
84
    }
85

86
    public function setSymfony($symfony): void
87
    {
88
        $this->symfony = $symfony;
×
89
    }
90

91
    public function setDummyDate(\DateTime $dummyDate): void
92
    {
93
        $this->dummyDate = $dummyDate;
×
94
    }
95

96
    public function getDummyDate()
97
    {
98
        return $this->dummyDate;
×
99
    }
100

101
    public function isDummyBoolean(): ?bool
102
    {
103
        return $this->dummyBoolean;
×
104
    }
105

106
    /**
107
     * @param bool $dummyBoolean
108
     */
109
    public function setDummyBoolean($dummyBoolean): void
110
    {
111
        $this->dummyBoolean = $dummyBoolean;
×
112
    }
113

114
    public function getThirdLevel(): ?ThirdLevel
115
    {
116
        return $this->thirdLevel;
×
117
    }
118

119
    public function setThirdLevel(?ThirdLevel $thirdLevel = null): void
120
    {
121
        $this->thirdLevel = $thirdLevel;
×
122
    }
123

124
    /**
125
     * Get relatedToDummyFriend.
126
     *
127
     * @return Collection<int, RelatedToDummyFriend>|iterable
128
     */
129
    public function getRelatedToDummyFriend(): Collection|iterable
130
    {
131
        return $this->relatedToDummyFriend;
×
132
    }
133

134
    /**
135
     * Set relatedToDummyFriend.
136
     *
137
     * @param RelatedToDummyFriend $relatedToDummyFriend the value to set
138
     */
139
    public function addRelatedToDummyFriend(RelatedToDummyFriend $relatedToDummyFriend): void
140
    {
NEW
141
        if (!$this->relatedToDummyFriend instanceof Collection) {
×
NEW
142
            return;
×
143
        }
144

UNCOV
145
        $this->relatedToDummyFriend->add($relatedToDummyFriend);
×
146
    }
147

148
    public function getEmbeddedDummy(): EmbeddableDummy
149
    {
150
        return $this->embeddedDummy;
×
151
    }
152

153
    public function setEmbeddedDummy(EmbeddableDummy $embeddedDummy): void
154
    {
155
        $this->embeddedDummy = $embeddedDummy;
×
156
    }
157

158
    public function __toString(): string
159
    {
160
        return (string) $this->getId();
×
161
    }
162
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc