a tiny mvc framework for php using php-activerecord
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Eager loading is now working with namespace'd relations (#107).

+9 -4
+8 -4
lib/php-activerecord/lib/Relationship.php
··· 155 155 156 156 $this->set_keys($this->get_table()->class->getName(), true); 157 157 158 - $class = isset($options['class_name']) ? 159 - $options['class_name'] : 160 - classify($options['through'], true); 161 - $through_table = $class::table(); 158 + if (!isset($options['class_name'])) { 159 + $class = classify($options['through'], true); 160 + $through_table = $class::table(); 161 + } else { 162 + $class = $options['class_name']; 163 + $relation = $class::table()->get_relationship($options['through']); 164 + $through_table = $relation->get_table(); 165 + } 162 166 $options['joins'] = $this->construct_inner_join_sql($through_table, true); 163 167 164 168 $query_key = $this->primary_key[0];
+1
lib/php-activerecord/test/HasManyThroughTest.php
··· 6 6 use foo\bar\biz\Newsletter; 7 7 8 8 class HasManyThroughTest extends DatabaseTest { 9 + 9 10 public function test_gh101_has_many_through() { 10 11 $user = User::find(1); 11 12 $newsletter = Newsletter::find(1);