Bonjour,
Voila je rencontre un petit problème avec mon code de formulaire de recherche
voici mon code indexcontroller.php et RsVoyageRepository.php l'erreur se trouve au niveau du fichier RsVoyageRepository.php
####indexcontroller.php#####
*****Debut******
public function voyage(request $request, RsVoyageRepository $RsVoyageRepository)
    {
        $results="";
        $count=$request->query->count()>0;
        if($count)
        {
            $choix  =$request->query->get('radio');
            $number =$request->query->get('number');
            $villedepart =$request->query->get('Villedepart');
            $Villearrivee =$request->query->get('Villearrivee');
            $datedepart =$request->query->get('datedepart');
            if($choix=="Allerretour"){ 
                $dateretour =$request->query->get('dateretour');
                 //$results = $this->getDoctrine()->getManager()->getRepository('App:RsVoyage')->findAlleretour($villedepart,$Villearrivee,$datedepart,$dateretour);
                  $results = $RsVoyageRepository->findAlleretour($villedepart,$Villearrivee,$datedepart,$dateretour);
            }
            else{
                // $results = $this->getDoctrine()->getManager()->getRepository('App:RsVoyage')->findAllersimple($Villedepart,$Villearrivee,$datedepart);
                $results = $RsVoyageRepository->findAllersimple($Villedepart,$Villearrivee,$datedepart);
                }
        }
        return $this->render('index/voyage.html.twig',[
          'Voyages' => $results
        ]);
    }
*****Fin********
####RsVoyageRepository.php#####
*****Debut******
<?php
namespace App\Repository;
use App\Entity\RsVoyage;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;
/**
 * @method RsVoyage|null find($id, $lockMode = null, $lockVersion = null)
 * @method RsVoyage|null findOneBy(array $criteria, array $orderBy = null)
 * @method RsVoyage[]    findAll()
 * @method RsVoyage[]    findAlleretour($Villedepart,$Villearrivee,$datedepart,$dateretour)
 * @method RsVoyage[]    findAllersimple($Villedepart,$Villearrivee,$datedepart)
 * @method RsVoyage[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
 */
class RsVoyageRepository extends ServiceEntityRepository
{
    public function __construct(RegistryInterface $registry)
    {
        parent::__construct($registry, RsVoyage::class);
    }
    /**
     * @return RsVoyage[] Returns an array of RsVoyage objects
     */
   public function findAlleretour($Villedepart,$Villearrivee,$datedepart,$dateretour)
    {
        $sql= $this->createQueryBuilder('r')
              ->andWhere('r.setVilledepart = :val')
              ->setParameter('val', $villedepart)
              ;
        var_dump($sql);exit();
        return $this
            ->createQueryBuilder('r')
            ->andWhere('r.setVilledepart = :val')
            ->setParameter('val', $villedepart)
            /*->andWhere('r.setVillearrivee = :val')
            ->setParameter('val', $Villearrivee)
            ->andWhere('r.setDate > ?1')
            ->andWhere('r.setDate < ?2')
            ->setParameter(1, $datedepart)
            ->setParameter(2, $dateretour)*/
            ->getQuery()
            ->getResult()
        ;
    }
    /*
    public function findOneBySomeField($value): ?RsVoyage
    {
        return $this->createQueryBuilder('r')
            ->andWhere('r.exampleField = :val')
            ->setParameter('val', $value)
            ->getQuery()
            ->getOneOrNullResult()
        ;
    }
    */
    /**
     * @return RsVoyage[] Returns an array of RsVoyage objects
     */
    public function findAllersimple($Villedepart,$Villearrivee,$datedepart):Query
    {
        return $this->createQueryBuilder('r')
        ->andWhere('r.setVilledepart = :val')
        ->setParameter('val', $Villedepart)
        ->andWhere('r.setVillearrivee = :val')
        ->setParameter('val', $Villearrivee)
        ->andWhere('r.setDate = :val')
        ->setParameter('val', $datedepart)
        ->getQuery()
        ->getResult()
        ;
    }
}
*****Fin********Décrivez ici ce que vous cherchez à obtenir
Décrivez ici vos erreurs ou ce que vous obtenez à la place de ce que vous attendez :(
 
  Bonjour olive140, merci pour votre reponse, exactement s'était ca l'erreur.
 
  Bonjour.
Dans la méthode findAlleretour tu as l'argument $Villedepart soit avec un v majuscule mais dans la méthode tu utilises la variable $villedepart soit avec un v minuscule, qui par conséquent n'est pas définie.
 
  Merci pour votre reponse Lartak, effectivement vous avez raison, mais en corrigeant, j'ai maintenant cette erreur : [Semantical Error] line 0, col 42 near 'v.setVilledepart': Error: 'v' is not defined.
 
  pardonner plutot cette erreur : [Semantical Error] line 0, col 44 near 'setVilledepart': Error: Class App\Entity\RsVoyage has no field or association named setVilledepart
 
  et voici mon code
fichier RsVoyage.php
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
 * @ORM\Entity(repositoryClass="App\Repository\RsVoyageRepository")
 */
class RsVoyage
{
    /**
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    private $id;
    /**
     * @ORM\Column(type="datetime")
     */
    private $date;
    /**
     * @ORM\Column(type="integer")
     */
    private $nbrekilo;
    /**
     * @ORM\Column(type="time")
     */
    private $nbreheure;
    /**
     * @ORM\Column(type="string", length=255)
     */
    private $villedepart;
    /**
     * @ORM\Column(type="string", length=255)
     */
    private $villearrivee;
    /**
     * @ORM\ManyToOne(targetEntity="App\Entity\RsCar")
     * @ORM\JoinColumn(nullable=false)
     */
    private $Car;
    public function getId(): ?int
    {
        return $this->id;
    }
    public function getDate(): ?\DateTimeInterface
    {
        return $this->date;
    }
    public function setDate(\DateTimeInterface $date): self
    {
        $this->date = $date;
        return $this;
    }
    public function getNbrekilo(): ?int
    {
        return $this->nbrekilo;
    }
    public function setNbrekilo(int $nbrekilo): self
    {
        $this->nbrekilo = $nbrekilo;
        return $this;
    }
    public function getNbreheure(): ?\DateTimeInterface
    {
        return $this->nbreheure;
    }
    public function setNbreheure(\DateTimeInterface $nbreheure): self
    {
        $this->nbreheure = $nbreheure;
        return $this;
    }
    public function getVilledepart(): ?string
    {
        return $this->villedepart;
    }
    public function setVilledepart(string $villedepart): self
    {
        $this->villedepart = $villedepart;
        return $this;
    }
    public function getVillearrivee(): ?string
    {
        return $this->villearrivee;
    }
    public function setVillearrivee(string $villearrivee): self
    {
        $this->villearrivee = $villearrivee;
        return $this;
    }
    public function getCar(): ?RsCar
    {
        return $this->Car;
    }
    public function setCar(?RsCar $Car): self
    {
        $this->Car = $Car;
        return $this;
    }
    public function __toString(){
        // to show the name of the Category in the select
        return $this->villedepart. "-" . $this->villearrivee;
        // to show the id of the Category in the select
        // return $this->id;
    }
}