Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Invalid
    • Affects Version/s: 2.1.6
    • Fix Version/s: None
    • Component/s: DQL, ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      XAMPP on Windows 7
      Doctrine in Combination with Symfony

      Description

      I keep getting an error while I'm trying to perfom an native query.
      If there is no result then everything is fine and I don't get any errors.

      Notice: Undefined index: id in C:\xampp\htdocs\Symfony\vendor\doctrine\lib\Doctrine\ORM\UnitOfWork.php line 1949

       
      $sql = "SELECT q.question FROM question q WHERE MATCH (q.question) AGAINST (?)";
      
      $rsm = new \Doctrine\ORM\Query\ResultSetMapping;
      $rsm->addEntityResult('WWMGameBundle:Question', 'q');
      $rsm->addFieldResult('q', 'question', 'question');
      
      $em = $this->getDoctrine()->getEntityManager();
      $query = $em->createNativeQuery($sql, $rsm);
      $query->setParameter(1, $request->request->get('q'));
      
      $search = $query->getResult();
      
       
      /**
      * WWM\Entity\Question
      *
      * @ORM\Entity(repositoryClass="WWM\Entity\QuestionsRepository")
      * @ORM\Table(name="question")
      */
      class Question
      {
          /**
           * @var integer $id
           *
           * @ORM\Column(name="id", type="integer", nullable=false)
           * @ORM\Id
           * @ORM\GeneratedValue(strategy="IDENTITY")
           */
          private $id;
      
          /**
           * @var integer $level
           *
           * @ORM\Column(name="level", type="integer", nullable=false)
           */
          private $level;
      
          /**
           * @var string $question
           *
           * @ORM\Column(name="question", type="string", length=255, nullable=false)
           */
          private $question;
      
      
      
          /**
           * Get id
           *
           * @return integer
           */
          public function getId()
          {
              return $this->id;
          }
      
          /**
           * Set level
           *
           * @param integer $level
           */
          public function setLevel($level)
          {
              $this->level = $level;
          }
      
          /**
           * Get level
           *
           * @return integer
           */
          public function getLevel()
          {
              return $this->level;
          }
      
          /**
           * Set question
           *
           * @param string $question
           */
          public function setQuestion($question)
          {
              $this->question = $question;
          }
      
          /**
           * Get question
           *
           * @return string
           */
          public function getQuestion()
          {
              return $this->question;
          }
      }
      

        Activity

        Moritz created issue -
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]
        Moritz made changes -
        Resolution Invalid [ 6 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Benjamin Eberlei made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 13707 ] jira-feedback [ 15347 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 15347 ] jira-feedback2 [ 17211 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17211 ] jira-feedback3 [ 19466 ]

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Moritz
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: