Countries - country_id | country_name
i
Voivodships - voivod_id | country_id | itd.
<!--Geshi:233516:php--><pre class="php-brief" style="font-family:monospace;"><div class="head">
[topic=0]o</span> <span class="sy0">=</span> [url="http://www.php.net/array"]<span class="kw3">array</span>[/url]<span class="br0">(</span><span class="st0">'country'</span><span class="br0">)</span><span class="sy0">;</span></div><li class="li1"><div class="de1"> protected <span class="re0">$primary_key</span> <span class="sy0">=</span> <span class="st0">'voivod_id'</span><span class="sy0">;</span></div> [/list]<div class="foot">[PHP] [url="./Pobierz-Plik-233517.html"]plaintext[/url] </div></pre><!--/Geshi:233517:php--> Robię: [php] $this -> countries = ORM::factory("country"); $countries = $this -> countries -> getAll(); foreach($countries as $c) { }
I otrzymuje:
Wystąpił błąd SQL: Nieznana kolumna 'voivodships.country_country_id' w where clause - SELECT `voivodships`.* FROM (`voivodships`) WHERE `voivodships`.`country_country_id` = 1 ORDER BY `voivodships`.`voivod_id` ASC
@edit
ok, protected $foreign_key = array('voivodships' => 'country_id');