Uploaded image for project: 'COmanage'
  1. COmanage
  2. CO-1096

ChangelogBehavior beforeFind with join in query fails

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • COmanage Registry 0.9.3 (Essential Enneagon Plus Plus Plus)
    • Registry
    • None

    Description

      When a model with ChanelogBehavior enabled uses a query for find that directly includes a join, for example

      $args = array();
      $args['joins'][0]['table'] = 'co_group_members';
      $args['joins'][0]['alias'] = 'CoGroupMember';
      $args['joins'][0]['type'] = 'INNER';
      $args['joins'][0]['conditions'][0] = 'CoPerson.id=CoGroupMember.co_person_id';

      the existing code adds conditions to the query resulting in SQL that may never return rows (it will not in particular if the join is a LEFT join).

      The fundamental problem is that the conditions added because of the join are added as constraints on the results after the SQL JOIN. When a LEFT join is used it is possible for the resulting columns from the joined table to be NULL if there is no data to "join up". The added conditions test for IS NOT true against that NULL and that can never be satisfied with, at least, MySQL.

      Attachments

        Activity

          People

            scott.koranda.3@at.internet2.edu Scott Koranda SCG (Inactive)
            scott.koranda.3@at.internet2.edu Scott Koranda SCG (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: