Fixing bugs in Eq2.
Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
This commit is contained in:
@@ -133,7 +133,7 @@ class Has_Many_And_Belongs_To extends Relationship {
|
||||
*/
|
||||
protected function set_select($foreign)
|
||||
{
|
||||
$foreign = $this->joining.'.'.$foreign.' as eloquent_foreign_key';
|
||||
$foreign = $this->joining.'.'.$foreign.' as pivot_foreign_key';
|
||||
|
||||
$this->table->select(array($this->model->table().'.*', $foreign));
|
||||
|
||||
@@ -201,7 +201,7 @@ class Has_Many_And_Belongs_To extends Relationship {
|
||||
*/
|
||||
public function match($relationship, &$parents, $children)
|
||||
{
|
||||
$foreign = 'eloquent_foreign_key';
|
||||
$foreign = 'pivot_foreign_key';
|
||||
|
||||
foreach ($children as $key => $child)
|
||||
{
|
||||
@@ -216,6 +216,20 @@ class Has_Many_And_Belongs_To extends Relationship {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean-up any pivot columns that are on the results.
|
||||
*
|
||||
* @param array $results
|
||||
* @return void
|
||||
*/
|
||||
protected function clean(&$results)
|
||||
{
|
||||
foreach ($results as &$result)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the other or associated key for the relationship.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php namespace Laravel\Database\Eloquent\Relationships; use Eloquent\Model;
|
||||
<?php namespace Laravel\Database\Eloquent\Relationships;
|
||||
|
||||
use Laravel\Database\Eloquent\Model;
|
||||
|
||||
class Has_One_Or_Many extends Relationship {
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php namespace Laravel\Database\Eloquent\Relationships; use Eloquent\Model, Eloquent\Query;
|
||||
<?php namespace Laravel\Database\Eloquent\Relationships;
|
||||
|
||||
use Laravel\Database\Eloquent\Model;
|
||||
use Laravel\Database\Eloquent\Query;
|
||||
|
||||
abstract class Relationship extends Query {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user