Answer the question
In order to leave comments, you need to log in
How to select an array of values of a certain column from an array of objects?
Let's say I do this:
Account::find()->where(...)->all() - I get an array of objects, each object has a field, for example id. I need a one dimensional array of id's of these objects. Is there a way to pull them out in one line? Maybe some ArrayHelper?
The output should be [1,2,3]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question