Witam, zaczynam przygodę z Doctrine i mam problem z Joinami. Mam taki fragment bazy:
(IMG:
http://danielkrasowski.pl/work/bazaf.png)
w modelu wyciągam dane za pomocą:
public static function getUnselectedService
($status) {
return Doctrine_Core::getTable('Service')
->createQuery('a')
->where('a.add_date < NOW()')
->leftJoin('a.ServiceStatusToService b ON a.id_status = b.id_status')
->andWhere('b.name = ?', $status)
->leftJoin('a.UserToService c ON a.id_user = c.id_user')
->leftJoin('c.UserToRank d ON c.id_user = d.id_user') // <- TEN JOIN POWODUJE BŁĄD
->execute();
}
Schamat wyglada tak:
User:
columns:
Id_user:
type: integer
notnull: true
primary: true
autoincrement: true
relations:
Status:
foreignAlias: User1
local: Id_status
foreign: Id_status
Services1:
type: meny
class: Service
local: Id_user
foreign: Id_user
foreignAlias: UserToService
Rank1:
type: meny
class: Rank
local: Id_user
foreign: Id_user
foreignAlias: UserToRank
Rank:
columns:
Id_user:
type: integer
notnull: true
relations:
Service:
columns:
Id_service:
type: integer
notnull: true
primary: true
autoincrement: true
Id_category:
type: integer
notnull: true
Id_status:
type: integer
notnull: true
Id_user:
type: integer
notnull: true
relations:
Service_status:
columns:
Id_status:
type: integer
notnull: true
primary: true
autoincrement: true
Name:
type: string(20)
relations:
Services:
type: meny
class: Service
local: Id_status
foreign: Id_status
foreignAlias: ServiceStatusToService
Problem jest taki ze ostatni JOIN wywala mi błąd, nie wiem co jest nie tak. Czy mogę liczyć na jakąś pomoc? Korzystam z symfony 1.4
Pozdrawiam
Ten post edytował Daniel_K 6.12.2010, 00:50:23