Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
ORM get format
  • Is there an easy way to change the format that the ORM returns data with on a ->get() At the moment, it returns ["1" : {}. "2: : {}] etc and I just need a simple array of objects like [{}, {}, {}] I'm aware that I can just process the data before returning but it would be cleaner if there was another way. Thanks!
  • The ORM's get() returns an array of Model objects. In case of numeric PK's, the array index is equal to the PK, which allows you to access results directly on PK value without looping over the result array. This is intentional and by design. If you want a simple indexed array, use array_values() to convert the result.
  • Great - thanks for the confirmation Harro.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion