Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Use of Hydration
  • The hydrate ORM method is not fully documented (or I could not find the right documentation).
    Do you have examples of its use ?
  • hydrate() is not something you can use, it's an internal method in the query class, which processes rows in the result, and splits join data (for related models) into different objects.

  • OK, I thought I could use it to create objects using complex queries written by hand... Is it reasonable to imagine doing this ?
  • HarroHarro
    Accepted Answer
    You can run custom queries using DB calls, and use as_object('Model_Something') to return the result as ORM model objects.

    There are some restrictions, one being the primary key needs to be part of the result. Also, there is no support for relations when you do that.

    In general, an ORM isn't the most suitable tool for complex operations. If you have something really complex, run a standard DB query, get the list of PK's from the result, and use that to run a "WHERE pk IN {list-of-keys} ORM query...
  • Perfect thanks !

Howdy, Stranger!

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

In this Discussion