Add uqury builder in easy_admin.yaml

{ property: ‘grade’, type: ‘entity’, type_options: { class: ‘App\Entity\Grade’, required: true, multiple: false, query_builder: [‘App\Repository\GradeRepository’, ‘available’] }, css_class: ‘col-sm-6’ }

Add static function in repogitory

    public static function available(GradeRepository $r): QueryBuilder
    {
        
        return $r->createQueryBuilder('g')
           ->innerJoin('g.school', 's')
           ->where('s.id = :school')
           ->setParameter('school', 2)
           ->orderBy('g.id', 'DESC');

     }

By toihid

Leave a Reply