Doctrine 1
  1. Doctrine 1
  2. DC-1016

Set method in update query ignores 'false' if passed as boolean

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Query
    • Labels:
      None
    • Environment:
      Symfony 1.4.11 , Ubuntu 11, PHP 5.3

      Description

      I had to define this function:

      public function deactivate($segment_id)

      { $query = $this->createQuery() ->update('Segment s') ->set('s.is_active ', false) //not working // ->set('s.is_active ', (int)false) //works ok // ->set('s.is_active ', true) //works ok ->where('s.id = ?', $segment_id); // var_dump($query->getSqlQuery());die; return $query->execute(); }

      Problem is that when setting a column using boolean false you get invalid SQL query like this:
      UPDATE segment SET is_active = WHERE (id = ?)

      Workaround is to do it like this: set('s.is_active ', (int)false) , but since setting the same column with boolean true works, false should work too.

        Activity

        Paweł Barański created issue -
        Guilherme Blanco made changes -
        Field Original Value New Value
        Affects Version/s 1.2.4 [ 10063 ]

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Paweł Barański
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: