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分
- マージ済み PR(30日)
- 14
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
phpstan/phpstan-doctrine のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
phpstan/phpstan-doctrine#816 ·
メンテナーはふだん 1 日以内に返信
-
EntityRepository.stub missing Selectable interface対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
phpstan/phpstan-doctrine#785 · リアクション 1 件 ·
メンテナーはふだん 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 ·