Skip to content

Commit

Permalink
Removes whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
louismrose committed Sep 23, 2016
1 parent 6c81292 commit 20a02d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ protected function set_class_name($class_name)
if (!has_absolute_namespace($class_name) && isset($this->options['namespace'])) {
$class_name = $this->options['namespace'].'\\'.$class_name;
}

$reflection = Reflections::instance()->add($class_name)->get($class_name);

if (!$reflection->isSubClassOf('ActiveRecord\\Model'))
Expand Down Expand Up @@ -505,7 +505,7 @@ public function load(Model $model)
$fk = $this->foreign_key;

$this->set_keys($this->get_table()->class->getName(), true);

$class = $this->class_name;
$relation = $class::table()->get_relationship($this->through);
$through_table = $relation->get_table();
Expand Down
14 changes: 7 additions & 7 deletions test/RelationshipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function set_up($connection_name=null)
Venue::$has_one = array();
Employee::$has_one = array(array('position'));
Host::$has_many = array(array('events', 'order' => 'id asc'));

foreach ($this->relationship_names as $name)
{
if (preg_match("/$name/", $this->getName(), $match))
Expand Down Expand Up @@ -80,26 +80,26 @@ public function test_has_many_basic()
{
$this->assert_default_has_many($this->get_relationship());
}

public function test_gh_256_eager_loading_three_levels_deep()
{
/* Before fix Undefined offset: 0 */
$conditions['include'] = array('events'=>array('host'=>array('events')));
$venue = Venue::find(2,$conditions);

$events = $venue->events;
$this->assertEquals(2,count($events));
$event_yeah_yeahs = $events[0];
$this->assertEquals('Yeah Yeah Yeahs',$event_yeah_yeahs->title);

$event_host = $event_yeah_yeahs->host;
$this->assertEquals('Billy Crystal',$event_host->name);

$bill_events = $event_host->events;

$this->assertEquals('Yeah Yeah Yeahs',$bill_events[0]->title);
}

/**
* @expectedException ActiveRecord\RelationshipException
*/
Expand Down

0 comments on commit 20a02d0

Please sign in to comment.