Sortowanie ma być po id ligi (league)
Encja Meet jest powiązana relacją z encją Team:
/** * @ORM\ManyToOne(targetEntity="App\Entity\Team") * @ORM\JoinColumn(nullable=false) */ private $hostTeam;
A encja Team z encją League:
/** * @ORM\ManyToOne(targetEntity="App\Entity\League", inversedBy="teams") * @ORM\JoinColumn(nullable=false) */ private $league;
Kod formularza :
class MeetType extends AbstractType { { $builder ->add('name' , null, ['label' => 'Nazwa']) ->add('hostGoals' , null, ['label' => 'Bramki gospodarz']) ->add('guestGoals' , null, ['label' => 'Bramki gość']) ->add('term' , null, ['label' => 'Termin meczu']) ->add('position' , null, ['label' => 'Pozycja meczu']) ->add('hostTeam' , null, ['label' => 'Gospodarz']) ->add('hostTeam', EntityType::class, [ 'class' => Team::class, 'query_builder' => function (EntityRepository $er) { return $er->createQueryBuilder('t') ->innerJoin('t.league', 'l') ->orderBy('l.id', 'ASC'); }, 'label' => 'Gospodarz', ])
Mam taki błąd:
Argument 1 passed to App\Form\MeetType::App\Form\{closure}() must be an instance of App\Form\EntityRepository, instance of App\Repository\TeamRepository given, called in C:\xampp\htdocs\ligatyperow2\vendor\symfony\doctrine-bridge\Form\Type\EntityType.php on line 32
Mogę prosić o podpowiedź co mam źle ?
PS. Sortowanie na razie może być po czymkolwiek bylebym wiedział co mam źle w obecnej implementacji kodu.