Calling CActiveRecord relation throws exception

I reported this issue in Google Code (issue 2873), but invalidated by Qiang. I think it is pretty much dead unless I post here to raise focus.

Basically, if a database table does not have primary key, and define a relation for it, we calling this relation, exception is thrown. This issue exists in Yii 1.1.8. ASAIK, any relation invokes lazyFind(). The problem is, CJoinElement lazyFind() does not check if the model’s primary key is null before for loop. The fix could be simple: add


if ($this->_table->primaryKey !== null)

at line 476 of CActiveFinder.php.

Have you tryed what Qiang suggested you in the issue?

I understand that’s a workaround and it works (i replied in the issue report), but what I’m seeking is a solution. I report this because I think it is a bug. Of course I can simply walk away and make some patch file for my local Yii copy, but I think that is irresponsible. Also, there is no backward compatibility issues.

If this is not a bug, what can be categorized as bug?

I’m sorry for repeating same words again and again. And thanks.