Firesphere

Updated the templates for the Slack Archive. It's minor, but if you want to support me in supporting this community archive, I've added a donate button. That's all. For now, I run this all on my own. Thankfully, @Ed Linklater has offered to host it for me, taking away that stress, so once transitioned, any donation done between now and forever, will be split between the two of us.

jkersu

yep, I only selecting a foreign key column

Joe

ah - yeah, because you’re probably only selecting a single column

I didn’t see a method to turn a multi-column result set into an array, though

jkersu

mmm... this seems to work $result = $sqlQuery->execute()->column();

Joe

honestly, I’d probably try to replace the SQLSelect with an ORM query, because it’s super easy to end up with an array of IDs using the ORM

Joe

^ yep, was just gonna say that

it doesn’t appear that there’s any quick method for turning that result set into an array though

jkersu

Yep so I think its because execute() return a Query which implements Iterator interface, so you can loop through it. Yep, so need to use SQLSelect for this particular use case

dorsetdigital

Do you need SQLSelect for that? Can't you do it in the ORM?

dorsetdigital

I'm sure that I used to do something like:

  1. $q = new SQLSelect();
  2. ...
  3.  
  4. $result = $q->execute();
  5. foreach ($result as $row) {
  6. echo $row['SomeColumn'];
  7. }