ORM 3.7 SortDirection support in orderBy clause
维护者通常 1 天内回复
评估
调研方向
Reproduce the example using QueryBuilder::orderBy with \SortDirection::Ascending and the nonexistent field. Find the orderBy analysis entry point and its regression tests, then ensure invalid fields are reported for enum direction values while valid fields remain accepted.
由索引模型根据 Issue 内容生成。
描述
It seems order by fields are not checked at all when order is given as the new \SortDirection enum (polyfilled on PHP 8.5 in this case).
<?php
namespace App\Entity;
use App\Repository\TestRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: TestRepository::class)]
class Test
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
public int $id;
#[ORM\Column]
public string $name;
}
<?php
namespace App\Repository;
use App\Entity\Test;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Test>
*/
class TestRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Test::class);
}
/**
* @return list<Test>
*/
public function test(): array
{
return $this->createQueryBuilder('t')
->orderBy('t.nonexistent2', \SortDirection::Ascending)
->getQuery()
->getResult()
;
}
}
[OK] No errors
- 主要语言
- PHP
- 星标
- 683
- 派生
- 129
- 平均合并
- 13 小时 6 分钟
- 30 天内合并 PR
- 14
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
phpstan/phpstan-doctrine 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
phpstan/phpstan-doctrine#816 ·
维护者通常 1 天内回复
-
EntityRepository.stub missing Selectable interface可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
phpstan/phpstan-doctrine#785 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 55/100
phpstan/phpstan-doctrine#822 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 1-2 天 新手友好度 48/100
phpstan/phpstan-doctrine#805 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 65/100
phpstan/phpstan-doctrine#788 · 2 条评论 ·
维护者通常 1 天内回复
查看 phpstan/phpstan-doctrine 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 63/100
phpstan/phpstan-phpunit#361 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
HE-Arc/le-panier-du-coin#49 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 2 天内回复
-
15.0
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 78/100
woocommerce/woocommerce-subscriptions-importer-exporter#298 ·