You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My current relationship using compoships works well: return $this->belongsTo('App\Models\PizzaPrice', ['pizza_id', 'size_id'], ['pizza_id', 'size_id']);
but after updating to 2.1.3 and altering it to use: return $this->belongsTo('App\Models\PizzaPrice', ['pizza_id', DB::raw('size_id')], ['pizza_id', 'size_id']);
or return $this->belongsTo('App\Models\PizzaPrice', ['pizza_id', DB::raw('table_name.size_id')], ['pizza_id', 'size_id']);
in order to test the new functionality it produces the following error: array_key_exists(): The first argument should be either a string or an integer
Am I not using this correctly? My end goal would be a relationship that is a few degrees removed and look something like this:
return $this->hasMany('B',
['foreignKey1', DB::raw('F.foreignKey2')], //or possibly providing a const value here
['localKey1', 'localKey2']
)
->join('C','C.other_key','=','B.other_key');
->join('D','D.other_key','=','C.other_key');
->join('E','E.other_key','=','D.other_key');
->join('F','F.other_key','=','E.other_key');
But that will not work since it dies when trying to use DB::raw('F.foreignKey2'). Please let me know if I can provide any further information and thank you.
The text was updated successfully, but these errors were encountered:
Hi, 2.1.3 feature works for hasOne, hasMany, fell free to make a PR for belongsTo
Also give the file and the line of the exception,
Did you try the inverse?
My current relationship using compoships works well:
return $this->belongsTo('App\Models\PizzaPrice', ['pizza_id', 'size_id'], ['pizza_id', 'size_id']);
but after updating to 2.1.3 and altering it to use:
return $this->belongsTo('App\Models\PizzaPrice', ['pizza_id', DB::raw('size_id')], ['pizza_id', 'size_id']);
or
return $this->belongsTo('App\Models\PizzaPrice', ['pizza_id', DB::raw('table_name.size_id')], ['pizza_id', 'size_id']);
in order to test the new functionality it produces the following error:
array_key_exists(): The first argument should be either a string or an integer
Am I not using this correctly? My end goal would be a relationship that is a few degrees removed and look something like this:
But that will not work since it dies when trying to use DB::raw('F.foreignKey2'). Please let me know if I can provide any further information and thank you.
The text was updated successfully, but these errors were encountered: