Skip to content

Commit

Permalink
Fix to issue laravel-ardent#211
Browse files Browse the repository at this point in the history
`Ardent->morphTo()` was overriding the check for eager loading on new Laravel 4.2 Eloquent Model.
laravel-ardent#211
  • Loading branch information
mspivak committed Jul 16, 2014
1 parent 8af3cf8 commit 1228dfe
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/LaravelBook/Ardent/Ardent.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,18 +414,10 @@ public function morphTo($name = null, $type = null, $id = null) {
{
$backtrace = debug_backtrace(false);
$caller = ($backtrace[1]['function'] == 'handleRelationalArray')? $backtrace[3] : $backtrace[1];

$name = snake_case($caller['function']);
}

// Next we will guess the type and ID if necessary. The type and IDs may also
// be passed into the function so that the developers may manually specify
// them on the relations. Otherwise, we will just make a great estimate.
list($type, $id) = $this->getMorphs($name, $type, $id);

$class = $this->$type;

return $this->belongsTo($class, $id);
return parent::morphTo($name, $type, $id);
}

/**
Expand Down

0 comments on commit 1228dfe

Please sign in to comment.