Doctrine 1
  1. Doctrine 1
  2. DC-337

Doctrine needs support for union all

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Won't Fix
    • Affects Version/s: 1.2.1
    • Fix Version/s: None
    • Component/s: Query
    • Labels:
      None
    • Environment:
      Mac Snow Leopard, Win XP
      PHP, MySql

      Description

      The following query cannot be retrieved as objects. The following will work with ->fetchAll(). However, the result set will return as an array. I need this to be as an object.

      return Doctrine_Manager::getInstance()>getCurrentConnection()>fetchAll("

      SELECT

      v1.*

      FROM (
      SELECT
      'song_comment' as user_action,
      null as artist_id, user_id, song_id, null as video_id, null as event_id, null as ip_address, null as is_going,
      comment, created_at
      FROM tbl_user_song_comment
      UNION ALL
      SELECT
      'videocomment' as user_action,
      null as artist_id, user_id, null as song_id, video_id, null as event_id, null as ip_address, null as is_going,
      comment, created_at
      FROM tbl_user_video_comment
      UNION ALL
      SELECT
      'event_comment' as user_action,
      null as artist_id, user_id, null as song_id, null as video_id, event_id, null as ip_address, null as is_going,
      comment, created_at
      FROM tbl_user_event_comment
      ) AS v1

      ORDER BY created_at DESC

      ");

      In summary, what I am trying to do is select all comments from tbl_user_song_comment, tbl_user_video_comment and tbl_user_event_comment and order by date (created_at).

      The following ticket at http://trac.doctrine-project.org/ticket/18 should have been implemented!
      There is no way in Doctrine to ->select() a view. In this case 'v1', since ->from() only expects a class!

        Activity

        Hide
        Guilherme Blanco added a comment -

        Branch 1.2 is our last branch in 1.X series and we do not expect to have any other enhancements so far.
        Marking this as won't fix, since we're not planning new middle point releases for 1.X series.

        Show
        Guilherme Blanco added a comment - Branch 1.2 is our last branch in 1.X series and we do not expect to have any other enhancements so far. Marking this as won't fix, since we're not planning new middle point releases for 1.X series.

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Chris F
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: