Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [Kohana] orm, dwa 'team id' w jednej tabeli [solved]
nmts
post
Post #1





Grupa: Zarejestrowani
Postów: 283
Pomógł: 34
Dołączył: 21.03.2008

Ostrzeżenie: (0%)
-----


Kod
Tabela Matches:
id | team_id | result


Tabela Teams:
id | name | logo

Widok:
$match->team->name;


I wszystko gra, tylko jak wiadomo w meczu są dwie drużyny, a nie jedna, wypadało by dodać więc jakieś team2_id.

Jak to zrobić? (IMG:style_emoticons/default/snitch.gif)

Mogłoby to wyglądać przykładowo:
$match->team2->name;

@edit
eh, jestem debilem (IMG:style_emoticons/default/snitch.gif)

  1. protected $_belongs_to = array("team" => array("model" => "team"),"team2" => array("model" => "team"));


Ten post edytował nmts 29.06.2010, 23:50:00
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 20:14