W bazie danych mam następujące pola:
- id
- idParent
- nazwa
- sciezkaKategoriiID
- poziom
Gdzie idParent to id krotki nadrzędnej. Poziom jest poziomem zagłębienia w drzewie, a ścieżka kategorii to wszystkie kategorie nadrzędne.
Mam zaimplementowaną relację w modelu kategorie:
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'podkategorie'=>array(self::HAS_MANY,'kategorie','idParent'),
);
}
Chcę wykonać instrukcje:
$kategorie = kategorie::model()->with('podkategorie')->findAll("idParent=:idParent",array(':idParent'=>$idParent));
Po wykonaniu intrukcji, yii zwraca mi błąd:
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'idParent' in where clause is ambiguous
Błąd ten mówi że mam dwa takie same nazwy kolumn w łączonych tabelach. Jak mogę dodać alias do tabeli łączonej w yii?

Help













