Doctrine 1
  1. Doctrine 1
  2. DC-776

$record->link('Alias', $id) throws an exception because of getIdentifier returns array, not string

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: Record, Relations, Schema Files
    • Labels:
      None
    • Environment:
      Symfony 1.4.6-DEV

      Description

      I want to bookmark ads on my site. So i have Ads table, users table (sfDoctrineGuard) and a refclass Bookmarks. I've created an ajax link to an action, where i retrieved $ad object, $user_id and
      $ad->link('Bookmarks', $user_id, true);
      So I expected a record in a database to be created.

      Bookmarks:
      ...
      columns:
      user_id:

      { type: integer(4), primary: true }

      ad_id:

      { type: integer(4), primary: true }

      relations:
      sfGuardUser:

      { onDelete: CASCADE, local: user_id, foreign: id }

      Ads:

      { onDelete: CASCADE, local: ad_id, foreign: ad_id }

      As my Bookmarks table has 2 primary keys in the link method

      if (count($ids) > 0)

      { $q->whereIn($rel->getTable()->getIdentifier(), array_values($this->identifier())); }

      $rel->getTable()->getIdentifier() returned me an array('user_id', 'ad_id') instead of a string. So the query which was generated looked like
      UPDATE bookmarks SET ad_id = ? WHERE (Array IN )
      And Array is not the name of a column.

      My schema:
      http://pastie.org/private/2lr9gy1h3mtdwdsiwrwylq

      I've solved an issue by creating a new Bookmark instance and saving it, but i presume that issue might distract someone.

        Activity

        There are no comments yet on this issue.

          People

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

            Dates

            • Created:
              Updated: