Doctrine 1
  1. Doctrine 1
  2. DC-781

Column order in generated SQL is based on relationships, instead of SELECT clause

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: Native SQL
    • Labels:
      None
    • Environment:
      Windows / PHP 5.2.4 / MySQL 5.1.41 / Symfony 1.4.0

      Description

      When executing below query as follows:
      $q = Doctrine_Query::create()
      ->select('bc.id, bbl.printed_name, bbl.rate, bc.name, bc.is_rate_variable')
      ->from('BillBatchLine bbl, bbl.Bill_Charge bc')
      ->where('bbl.bill_batch_id = ?', $bill_batch_id);
      return $q->execute(array(), Doctrine::HYDRATE_NONE);

      SQL generated is:
      SELECT b.printed_name AS b_printed_name, b.rate AS brate, b2.id AS b2id, b2.name AS b2name, b2.is_rate_variable AS b2_is_rate_variable FROM Bill_Batch_Lines b LEFT JOIN bill_charges b2 ON b.bill_charge_id = b2.id AND (b2.deleted_at IS NULL) WHERE (b.bill_batch_id = '2' AND b.society_id = '1' AND b2.society_id = '1' AND (b.deleted_at IS NULL))

      Basically, columns are ordered based on relationships and not as defined in the SELECT clause

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            Prasad Gupte
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: