• 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/Common/Tests/Fixtures/TestBundle/Entity/Dummy.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\Common\Tests\Fixtures\TestBundle\Entity;
15

16
use ApiPlatform\Metadata\ApiProperty;
17
use ApiPlatform\Metadata\ApiResource;
18
use ApiPlatform\Metadata\Get;
19
use ApiPlatform\Metadata\Link;
20
use Doctrine\Common\Collections\ArrayCollection;
21
use Doctrine\Common\Collections\Collection;
22
use Doctrine\ORM\Mapping as ORM;
23
use Symfony\Component\Validator\Constraints as Assert;
24

25
/**
26
 * Dummy.
27
 *
28
 * @author Kévin Dunglas <dunglas@gmail.com>
29
 */
30
#[ApiResource(filters: ['my_dummy.boolean', 'my_dummy.date', 'my_dummy.exists', 'my_dummy.numeric', 'my_dummy.order', 'my_dummy.range', 'my_dummy.search', 'my_dummy.property'], extraProperties: ['standard_put' => false])]
31
#[ApiResource(uriTemplate: '/related_owned_dummies/{id}/owning_dummy{._format}', uriVariables: ['id' => new Link(fromClass: RelatedOwnedDummy::class, identifiers: ['id'], fromProperty: 'owningDummy')], status: 200, filters: ['my_dummy.boolean', 'my_dummy.date', 'my_dummy.exists', 'my_dummy.numeric', 'my_dummy.order', 'my_dummy.range', 'my_dummy.search', 'my_dummy.property'], operations: [new Get()])]
32
#[ApiResource(uriTemplate: '/related_owning_dummies/{id}/owned_dummy{._format}', uriVariables: ['id' => new Link(fromClass: RelatedOwningDummy::class, identifiers: ['id'], fromProperty: 'ownedDummy')], status: 200, filters: ['my_dummy.boolean', 'my_dummy.date', 'my_dummy.exists', 'my_dummy.numeric', 'my_dummy.order', 'my_dummy.range', 'my_dummy.search', 'my_dummy.property'], operations: [new Get()])]
33
#[ORM\Entity]
34
class Dummy
35
{
36
    /**
37
     * @var int|null The id
38
     */
39
    #[ORM\Column(type: 'integer', nullable: true)]
40
    #[ORM\Id]
41
    #[ORM\GeneratedValue(strategy: 'AUTO')]
42
    private $id;
43

44
    /**
45
     * @var string The dummy name
46
     */
47
    #[ApiProperty(iris: ['https://schema.org/name'])]
48
    #[ORM\Column]
49
    #[Assert\NotBlank]
50
    private string $name;
51

52
    /**
53
     * @var string|null The dummy name alias
54
     */
55
    #[ApiProperty(iris: ['https://schema.org/alternateName'])]
56
    #[ORM\Column(nullable: true)]
57
    private $alias;
58

59
    /**
60
     * @var array foo
61
     */
62
    private ?array $foo = null;
63

64
    /**
65
     * @var string|null A short description of the item
66
     */
67
    #[ApiProperty(iris: ['https://schema.org/description'])]
68
    #[ORM\Column(nullable: true)]
69
    public $description;
70

71
    /**
72
     * @var string|null A dummy
73
     */
74
    #[ORM\Column(nullable: true)]
75
    public $dummy;
76

77
    /**
78
     * @var bool|null A dummy boolean
79
     */
80
    #[ORM\Column(type: 'boolean', nullable: true)]
81

82
    public ?bool $dummyBoolean = null;
83
    /**
84
     * @var \DateTime|null A dummy date
85
     */
86
    #[ApiProperty(iris: ['https://schema.org/DateTime'])]
87
    #[ORM\Column(type: 'datetime', nullable: true)]
88
    public $dummyDate;
89

90
    /**
91
     * @var float|null A dummy float
92
     */
93
    #[ORM\Column(type: 'float', nullable: true)]
94
    public $dummyFloat;
95

96
    /**
97
     * @var string|null A dummy price
98
     */
99
    #[ORM\Column(type: 'decimal', precision: 10, scale: 2, nullable: true)]
100
    public $dummyPrice;
101

102
    #[ApiProperty(push: true)]
103
    #[ORM\ManyToOne(targetEntity: RelatedDummy::class)]
104
    public ?RelatedDummy $relatedDummy = null;
105

106
    /**
107
     * @var Collection<int, RelatedDummy>|iterable
108
     */
109
    #[ORM\ManyToMany(targetEntity: RelatedDummy::class)]
110
    public Collection|iterable $relatedDummies;
111

112
    /**
113
     * @var array|null serialize data
114
     */
115
    #[ORM\Column(type: 'json', nullable: true)]
116
    public $jsonData = [];
117

118
    /**
119
     * @var array|null
120
     */
121
    #[ORM\Column(type: 'simple_array', nullable: true)]
122
    public $arrayData = [];
123

124
    /**
125
     * @var string|null
126
     */
127
    #[ORM\Column(nullable: true)]
128
    public $nameConverted;
129

130
    /**
131
     * @var RelatedOwnedDummy|null
132
     */
133
    #[ORM\OneToOne(targetEntity: RelatedOwnedDummy::class, cascade: ['persist'], mappedBy: 'owningDummy')]
134
    public $relatedOwnedDummy;
135

136
    /**
137
     * @var RelatedOwningDummy|null
138
     */
139
    #[ORM\OneToOne(targetEntity: RelatedOwningDummy::class, cascade: ['persist'], inversedBy: 'ownedDummy')]
140
    public $relatedOwningDummy;
141

142
    public static function staticMethod(): void
143
    {
144
    }
×
145

146
    public function __construct()
147
    {
148
        $this->relatedDummies = new ArrayCollection();
×
149
    }
150

151
    public function getId()
152
    {
153
        return $this->id;
×
154
    }
155

156
    public function setId($id): void
157
    {
158
        $this->id = $id;
×
159
    }
160

161
    public function setName(string $name): void
162
    {
163
        $this->name = $name;
×
164
    }
165

166
    public function getName(): string
167
    {
168
        return $this->name;
×
169
    }
170

171
    public function setAlias($alias): void
172
    {
173
        $this->alias = $alias;
×
174
    }
175

176
    public function getAlias()
177
    {
178
        return $this->alias;
×
179
    }
180

181
    public function setDescription($description): void
182
    {
183
        $this->description = $description;
×
184
    }
185

186
    public function getDescription()
187
    {
188
        return $this->description;
×
189
    }
190

191
    public function fooBar($baz): void
192
    {
193
    }
×
194

195
    public function getFoo(): ?array
196
    {
197
        return $this->foo;
×
198
    }
199

200
    public function setFoo(?array $foo = null): void
201
    {
202
        $this->foo = $foo;
×
203
    }
204

205
    public function setDummyDate(?\DateTime $dummyDate = null): void
206
    {
207
        $this->dummyDate = $dummyDate;
×
208
    }
209

210
    public function getDummyDate()
211
    {
212
        return $this->dummyDate;
×
213
    }
214

215
    public function setDummyPrice($dummyPrice)
216
    {
217
        $this->dummyPrice = $dummyPrice;
×
218

219
        return $this;
×
220
    }
221

222
    public function getDummyPrice()
223
    {
224
        return $this->dummyPrice;
×
225
    }
226

227
    public function setJsonData($jsonData): void
228
    {
229
        $this->jsonData = $jsonData;
×
230
    }
231

232
    public function getJsonData()
233
    {
234
        return $this->jsonData;
×
235
    }
236

237
    public function setArrayData($arrayData): void
238
    {
239
        $this->arrayData = $arrayData;
×
240
    }
241

242
    public function getArrayData()
243
    {
244
        return $this->arrayData;
×
245
    }
246

247
    public function getRelatedDummy(): ?RelatedDummy
248
    {
249
        return $this->relatedDummy;
×
250
    }
251

252
    public function setRelatedDummy(RelatedDummy $relatedDummy): void
253
    {
254
        $this->relatedDummy = $relatedDummy;
×
255
    }
256

257
    public function addRelatedDummy(RelatedDummy $relatedDummy): void
258
    {
NEW
259
        if (!$this->relatedDummies instanceof Collection) {
×
NEW
260
            return;
×
261
        }
262

UNCOV
263
        $this->relatedDummies->add($relatedDummy);
×
264
    }
265

266
    public function getRelatedOwnedDummy()
267
    {
268
        return $this->relatedOwnedDummy;
×
269
    }
270

271
    public function setRelatedOwnedDummy(RelatedOwnedDummy $relatedOwnedDummy): void
272
    {
273
        $this->relatedOwnedDummy = $relatedOwnedDummy;
×
274
        if ($this !== $this->relatedOwnedDummy->getOwningDummy()) {
×
275
            $this->relatedOwnedDummy->setOwningDummy($this);
×
276
        }
277
    }
278

279
    public function getRelatedOwningDummy()
280
    {
281
        return $this->relatedOwningDummy;
×
282
    }
283

284
    public function setRelatedOwningDummy(RelatedOwningDummy $relatedOwningDummy): void
285
    {
286
        $this->relatedOwningDummy = $relatedOwningDummy;
×
287
    }
288

289
    public function isDummyBoolean(): ?bool
290
    {
291
        return $this->dummyBoolean;
×
292
    }
293

294
    /**
295
     * @param bool $dummyBoolean
296
     */
297
    public function setDummyBoolean($dummyBoolean): void
298
    {
299
        $this->dummyBoolean = $dummyBoolean;
×
300
    }
301

302
    public function setDummy($dummy = null): void
303
    {
304
        $this->dummy = $dummy;
×
305
    }
306

307
    public function getDummy()
308
    {
309
        return $this->dummy;
×
310
    }
311

312
    /**
313
     * @return Collection<int, RelatedDummy>|iterable
314
     */
315
    public function getRelatedDummies(): Collection|iterable
316
    {
317
        return $this->relatedDummies;
×
318
    }
319
}
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