Details
-
Type:
Bug
-
Status:
Open
-
Priority:
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:
ad_id:
{ type: integer(4), primary: true } relations:
sfGuardUser:
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
| Field | Original Value | New Value |
|---|---|---|
| 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. |
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. |
| Priority | Major [ 3 ] | Minor [ 4 ] |