CRUD Controller feature request: $crud->addSearchField()

オープン
#7,776 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
php, symfony
領域
backend

調査の方向性

AbstractCrudController::configureCrud から始め、setSearchFields() の既存の動作を追跡してください。これには、デフォルトで検索可能なプロパティフィールドがどのように決定されるかも含まれます。addSearchField() と addSearchFields() の API を定義する前に、CRUD 設定と関連するテストを確認してください。要求された例をカバーするテストがあり、デフォルトの検索フィールドを手動でコピーせずに関連プロパティを追加できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Short description of what this feature will allow to do:
In the AbstractCrudController::configureCrud method, there is a way to pass a set of searchable fields via setSearchFields():

public function configureCrud(Crud $crud): Crud
{
    return $crud
       ...
        ->setSearchFields(['name', 'description', 'seller.email', 'seller.address.zipCode'])
        ...

https://symfony.com/bundles/EasyAdminBundle/current/crud.html#search-order-and-pagination-options

However, if you have an association, you would need to explicitly declare all of the searchable fields, which could be quite a few:

// Manually include default search fields, and an association property field
 $crud->setSearchFields(['name','description',...,...,'association_field.property'];

Example of how to use this feature
It would be nice to be able to simply tack on the association field rather than copy paste all the other fields and then add the other field, something like:

// Include all the default property fields, and the additional association property:
$crud->addSearchField('association_field.property');

and / or

$crud->addSearchFields(['association_field.property']);
主要言語
PHP
スター
4.3k
フォーク
1.1k
平均マージ
2日 9時間
マージ済み PR(30日)
52

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

EasyCorp/EasyAdminBundle のほかの issue

EasyCorp/EasyAdminBundle の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。