ardent
ardent copied to clipboard
belongsTo doesn't find right foreingKey
If foreingKey is not specified belongsTo doesn't find the right function to determine it. in version 3.0.0 this was the code:
$backtrace = debug_backtrace(false);
$caller = ($backtrace[1]['function'] == 'handleRelationalArray')? $backtrace[3] : $backtrace[1];
$relation = $caller['function'];
in the latest release (3.2.0) is:
if ($backtrace[1]['function'] == 'handleRelationalArray') {
$relation = $backtrace[1]['args'][0];
} else {
$relation = $backtrace[3]['function'];
}
As you can see, in 3.2.0 relase $backtrace[1] and backtrace[3] are inverted compared to the version 3.0.0 and this release works well.
Inverting $backtrace[1] with $backtrace[3] works well.
Thanks ENx
I do also getting problem on belongsTo if local_key
is not specified. When calling associate function it trying to insert value to a column named call_id
which doesn't available.
I can confirm this issue.
There is pull request with it: https://github.com/laravel-ardent/ardent/pull/295