title: Variable undefined when using Doctrine QueryBuilder
body: <p>I want to make alternative way for making stored procedures by using Doctrine but I am stuck, could any one help me? </p>
  
  <h2>Example stored procedure to be formed:</h2>
  
  <pre><code>CREATE PROCEDURE catalog_get_department_details(IN DepartmentName)
      BEGIN
      SELECT name, description
      FROM
      department
      WHERE name = name;
  </code></pre>
  
  <h2>Departments Entity:</h2>
  
  <pre><code>/**
   * @ORM\Entity(repositoryClass="AppBundle\Repository\departmentsRepository")
   * @ORM\Table(name="departments")
   */
  class departments
  {
      /**
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       * @ORM\Column(type="integer")
       */
      private $department_id;
  
      /**
       * @ORM\Column(type="string")
       */
      private $name;
  
      /**
       * @ORM\Column(type="string", nullable=true)
       */
      private $description;
  
      /**
       * @ORM\OneToMany(targetEntity="categories",mappedBy="departments")
       */
      private $categories;
  
      function __construct()
      {
          $this-&gt;categories = new ArrayCollection();
      }
  
      public function getDepartmentId()
      {
          return $this-&gt;department_id;
      }
  
      public function setDepartmentId($department_id)
      {
          $this-&gt;department_id = $department_id;
      }
  
      /**
       * @return mixed
       */
      public function getName()
      {
          return $this-&gt;name;
      }
  
      /**
       * @param mixed $name
       */
      public function setName($name)
      {
          $this-&gt;name = $name;
      }
  
      /**
       * @return mixed
       */
      public function getDescription()
      {
          return $this-&gt;description;
      }
  
      /**
       * @param mixed $description
       */
      public function setDescription($description)
      {
          $this-&gt;description = $description;
      }
  </code></pre>
  
  <p>The scenario is when the route is <strong>/index/departmentname/Regional</strong> ;
  my <strong>DefaultController</strong> will capture <strong>Regional</strong> as parameter</p>
  
  <h2>DefaultController:</h2>
  
  <pre><code>class DefaultController extends Controller
  {
      /**
       * @Route ("/index/department/{department_name}")
       */
      function departmentAction($department_name)
      {
          // accessing departmentsRepository 
          $categoriesRepository = $this-&gt;getDoctrine()-&gt;getManager()
              -&gt;getRepository('AppBundle:departments');
          $categoriesRepository-&gt;getDepartmentDetails($department_name);
      }
  </code></pre>
  
  <h2>departmentsRepository:</h2>
  
  <pre><code>class departmentsRepository extends \Doctrine\ORM\EntityRepository
  {
      function getDepartmentDetails($departmentName)
      {
          $em=$this-&gt;getEntityManager()-&gt;getRepository('AppBundle:departments');
          $qb=$em-&gt;createQueryBuilder('dep');
          $qb-&gt;select('dep.name','dep.description');
          $qb-&gt;where("dep.name=$departmentName");
  </code></pre>
  
  <p>When I call <code>var_dump($qb-&gt;getDQL());die;</code> it shows me exactly what I want:</p>
  
  <blockquote>
    <p>SELECT dep.name, dep.description FROM AppBundle\Entity\departments dep WHERE dep.name=Regional</p>
  </blockquote>
  
  <p>I then execute it by calling</p>
  
  <pre><code>$qb-&gt;getQuery()-&gt;execute();
  </code></pre>
  
  <p>But I receive the following error:</p>
  
  <blockquote>
    <p>[Semantical Error] line 0, col 86 near 'Regional': Error: 'Regional'
    is not defined.</p>
  </blockquote>
  
  <p>Any idea what I'm doing wrong?</p>