Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
ORM relation conditions
  • Hi,
    I set up the following conditions in the model: <code>'conditions' => array(
    'where' => array(
    array('ar', '>', '0')
    )</code>
    But it escapes the zero and produces this: <code>ON (`t0`.`termekkod` = `t3`.`bcikkszam` AND `t3`.`ar` > `0`)</code> Sure it doesn't find the 0 column. How can I fix this? Thanks,
    Mark
  • Hi, I couldn't solve my actual problem, so I ask for help. I have a model which has many related to another (so it belongs to). When I query the main model I want to have the only row from the has many related model which's specified column is not null and is the minimum value. So :
    Main model:
    id
    productcode
    etc Price model:
    id
    productcode
    seller
    price => can be 0 if the seller doesn't have it, and I want to show the smallest which is not null. How can I do it with models?
    I must do it in one query, because I show only those products, which has a price and not null. Thanks,
    Mark
  • I think I can solve the problem, but I need a way to give an exact value to the condition which will not be escaped. Thanks
  • Not sure if you can in the relationship setup, but have you tried using \DB::expr ?
  • Yes, I tried.

Howdy, Stranger!

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

In this Discussion