We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Say I have 2 tables:
bars
+--+---+ |id|bar| +--+---+
foos
+--+------+---+ |id|bar_id|foo| +--+------+---+
And in php you have the active record model classes foo and bar.
If you have a belongs_to relation from foo to bar, you can use $foo_var->bar
belongs_to
$foo_var->bar
The problem is that if you have an array of foo objects ($foo_arr), then you are not able to use
$foo_arr
array_column($foo_arr, 'bar') to get an array of bar objects.
array_column($foo_arr, 'bar')
Workaround:
$bar_arr = array_map( function($foo) { return $foo->bar; }, $foo_arr );
Request to fix this issue by making array_column work with php activerecord relations or to provide a function that has the same functionality.
array_column
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Say I have 2 tables:
bars
foos
And in php you have the active record model classes foo and bar.
If you have a
belongs_to
relation from foo to bar, you can use$foo_var->bar
The problem is that if you have an array of foo objects (
$foo_arr
), then you are not able to usearray_column($foo_arr, 'bar')
to get an array of bar objects.Workaround:
Request to fix this issue by making
array_column
work with php activerecord relations or to provide a function that has the same functionality.The text was updated successfully, but these errors were encountered: