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

api-platform / core / 14925420478

09 May 2025 09:03AM UTC coverage: 7.739% (+0.6%) from 7.179%
14925420478

Pull #7134

github

web-flow
Merge a0984c209 into 4ddce1f53
Pull Request #7134: refactor(metadata): type parameters to list<string>|string

48 of 134 new or added lines in 15 files covered. (35.82%)

2 existing lines in 2 files now uncovered.

12267 of 158510 relevant lines covered (7.74%)

15.54 hits per line

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

0.0
/tests/Fixtures/TestBundle/Entity/FilteredOrderParameter.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\Tests\Fixtures\TestBundle\Entity;
15

16
use ApiPlatform\Doctrine\Common\Filter\OrderFilterInterface;
17
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
18
use ApiPlatform\Metadata\ApiResource;
19
use ApiPlatform\Metadata\GetCollection;
20
use ApiPlatform\Metadata\QueryParameter;
21
use Doctrine\ORM\Mapping as ORM;
22
use Symfony\Component\TypeInfo\Type\BuiltinType;
23
use Symfony\Component\TypeInfo\TypeIdentifier;
24

25
#[ApiResource]
26
#[GetCollection(
27
    paginationItemsPerPage: 5,
×
28
    parameters: [
×
29
        'createdAt' => new QueryParameter(
×
30
            filter: new OrderFilter(),
×
NEW
31
            nativeType: new BuiltinType(TypeIdentifier::STRING)
×
32
        ),
×
33
        'date' => new QueryParameter(
×
34
            filter: new OrderFilter(),
×
35
            property: 'createdAt',
×
NEW
36
            nativeType: new BuiltinType(TypeIdentifier::STRING)
×
37
        ),
×
38
        'date_null_always_first' => new QueryParameter(
×
39
            filter: new OrderFilter(),
×
40
            property: 'createdAt',
×
41
            filterContext: OrderFilterInterface::NULLS_ALWAYS_FIRST,
×
NEW
42
            nativeType: new BuiltinType(TypeIdentifier::STRING)
×
43
        ),
×
44
        'date_null_always_first_old_way' => new QueryParameter(
×
45
            filter: new OrderFilter(properties: ['createdAt' => OrderFilterInterface::NULLS_ALWAYS_FIRST]),
×
46
            property: 'createdAt',
×
NEW
47
            nativeType: new BuiltinType(TypeIdentifier::STRING)
×
48
        ),
×
49
        'order[:property]' => new QueryParameter(
×
50
            filter: new OrderFilter(),
×
51
            filterContext: OrderFilterInterface::NULLS_ALWAYS_FIRST,
×
52
        ),
×
53
    ],
×
54
)]
×
55
#[ORM\Entity]
56
class FilteredOrderParameter
57
{
58
    public function __construct(
59
        #[ORM\Column]
60
        #[ORM\Id]
61
        #[ORM\GeneratedValue(strategy: 'AUTO')]
62
        public ?int $id = null,
63

64
        #[ORM\Column(nullable: true)]
65
        public ?\DateTimeImmutable $createdAt = null,
66
    ) {
67
    }
×
68

69
    public function getId(): ?int
70
    {
71
        return $this->id;
×
72
    }
73

74
    public function getCreatedAt(): ?\DateTimeImmutable
75
    {
76
        return $this->createdAt;
×
77
    }
78

79
    public function setCreatedAt(?\DateTimeImmutable $createdAt): void
80
    {
81
        $this->createdAt = $createdAt;
×
82
    }
83
}
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