Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Where clause on 2 Models
  • Hello, quick question about ORM. I have a Model_Match that has many Model_Ticket. I can get the tickets for all the matches and then Model_Ticket->match contains them all
    But I would like to get all tickets sold for the upcoming match... something like that
    Model_Ticket::find()->where_open()
         ->where( 'match.start', '>', $time)            
         ->where_close()->get();
    

    does not seem to work. Is it possible to do something like that ? Thanks
    Chris
  • See the 'relations' page of the ORM documentation. You need to specify your related table on the query:
    Model_Ticket::find()
        ->related('match')
        ->where( 'match.start', '>', $time)
        ->get();
    
  • oh damn. I missed it! Thanks man!

Howdy, Stranger!

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

In this Discussion