title: How to retrieve Year from a complete date ( Type: Date) with Symfony 3.4
body: <p>I have a date field of type Date. I want to take that value of the year. thank you for giving me help.
  because I searched the internet but I did not find the solution.
  thanks for your understanding.</p>
  
  <p>this is the format of date that i use :
       $date = $form->get('date')->getData();
      $date->format('Y-m-d')
  this is my repository:</p>
  
  <pre><code>  public function findEnglishByTags($date, $categorie, $tags) {
      $tags_values = $tags-&gt;getValues();
      array_walk($tags_values, function (&amp;$item) {
          $item = $item-&gt;getId();
      });
  
      $qb = $this-&gt;createQueryBuilder('english');
      $qb-&gt;where('english.date = :date')
              -&gt;andWhere('english.Categorie IN (:categories)')
              -&gt;leftjoin('english.tags', 't')
              -&gt;andWhere('t.id IN (:tags)')
              -&gt;setParameters(array('date' =&gt; $date, 'categories' =&gt; $categorie-&gt;getId(), 'tags' =&gt; $tags))
      ;
  
      return $qb-&gt;getQuery()-&gt;getResult();
  }
  </code></pre>
  
  <p>my controller:</p>
  
  <pre><code>  public function searchAction()
  {
      $form = $this-&gt;createForm('MDWEB\FrontBundle\Form\InEnglishFrontType');
      $request = $this-&gt;container-&gt;get('request_stack')-&gt;getCurrentRequest();
      $form-&gt;handleRequest($request);
      $date = $form-&gt;get('date')-&gt;getData();
      $categorie = $form-&gt;get('categorie')-&gt;getData();
      $tags = $form-&gt;get('tags')-&gt;getData();
      $em = $this-&gt;getDoctrine()-&gt;getManager();
      $listEnglishs = $em-&gt;getRepository('MDWEBInEnglishBundle:InEnglish')
          -&gt;findEnglishBytags(new \DateTime($date-&gt;format('Y')), $categorie, $tags);
  
      return $this-&gt;render('MDWEBFrontBundle:InEnglish:list.html.twig', array(
          'form' =&gt; $form-&gt;createView(),
          'listEnglishs' =&gt; $listEnglishs
      ));
  }
  </code></pre>
  
  <p>i want to change date by Year knowing that i haven't a field named Year in my entity.</p>