Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
ORM from subquery
  • Hi!
    I currently have this code, which produces a DB query like this. However I need a query like this. I thought the best way to do this is to use a subquery, but I got an error saying, that a ->from() is undefined in ORM\Query class. Is there a way to achieve something similar without using direct DB queries?
  • Try switching to 1.8/dev for the ORM package.

    I've made some changes to move WHERE clauses to the subquery when they only reference a column of the main table, and I'm not sure they made the 1.7.2. release.
  • Could you please provide me a link?
  • Sorry for not responding, I've had a lot to do.
    I've switched to the 1.8 branch, but the result is still the same.
  • HarroHarro
    Accepted Answer
    It might fail to detect it can (and should) move the where() clause to the subquery because of your rather complex and/or nesting?

    If

    ->where('branch_id', 'IN', array_keys(\Session::get('pce_user.active_branches')))

    is your primary selection criteria, why is it somewhere inside some and / or construction?
  • Thanks, moving it outside really helped.

Howdy, Stranger!

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

In this Discussion