Doctrine 1
  1. Doctrine 1
  2. DC-742

Add support for relations consist on two or more fileds

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Relations
    • Labels:
      None
    • Environment:
      n/a

      Description

      Let's say I have following tables:

      article

      • art_id

      article_version

      • art_id
      • art_version

      category

      • cat_id

      category2article

      • cat_id
      • art_id

      category2article_version

      • cat_id
      • art_id
      • art_version

      As I know I can describe relation between tables `article` and `category`, but I cannot describe relation between `artcile_version` and `category`.
      The problem is Doctrine supports only following relation mapping:
      $this->hasMany('Category as categories', array(
      'local' => 'art_id',
      'foreign' => 'cat_id',
      'refClass' => 'Category2Article'
      ));

      It would be nice to have also something like that:
      $this->hasMany('Category as categories', array(
      'local' => array('art_id', 'art_version')
      'foreign' => 'cat_id',
      'refClass' => 'Category2ArticleVc'
      ));

      In the first (supported) example Doctrine produce something like that, when I add LEFT JOIN STATEMENT:
      SELECT *
      FROM article a
      LEFT OUTER JOIN category2article c2a ON c2a.art_id = a.art_id
      LEFT OUTER JOIN category c ON c.cat_id = c2a.cat_id

      But I would like to have also support for following example:
      SELECT *
      FROM article_version a_vc
      LEFT OUTER JOIN category2article_version c2a_vc ON c2a_vc.art_id = a_vc.art_id AND c2a_vc.art_version = a_vc.art_version
      LEFT OUTER JOIN category c ON c.cat_id = c2a_vc.cat_id


      Very best,
      Tomasz Kuter

      PS. I will check Doctrine code.. maybe I will solve it by myself..

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Tomasz Kuter
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: