1

Does anyone know a way to debug NotORM's requests?

I am able to get the SQL query it executes by printf-ing the NotORM object.

Example:

$models = $this->dbh->wh_product()->select("wh_model.id, wh_model.manufacturer, wh_model.model, wh_model.details, wh_model.wh_category.category, crm_contact.ragione")->order("wh_model.wh_category.id ASC, crm_contact.ragione ASC, wh_model.model ASC");

printf($models);

This gives:

SELECT
    wh_model.id,
    wh_model.manufacturer,
    wh_model.model,
    wh_model.details,
    wh_category.category,
    crm_contact.ragione
FROM
    wh_product
LEFT JOIN wh_model ON wh_product.wh_model_id = wh_model.id
LEFT JOIN wh_category ON wh_model.wh_category_id = wh_category.id
LEFT JOIN crm_contact ON wh_product.crm_contact_id = crm_contact.id
ORDER BY
    wh_category.id ASC,
    crm_contact.ragione ASC,
    wh_model.model ASC

I'm having problems with this query because if I manually execute this via phpMyAdmin I get something like 90 results, but NotORM gives me only 14.

Is there a way to understand what is happening with NotORM?

Thanks

mitkosoft
  • 5,262
  • 1
  • 13
  • 31
mrteo
  • 11
  • 3

1 Answers1

0

I ran into an issue with iterator_to_array messing with the result set. In my case, I was viewing the result set with

print_r(iterator_to_array($notormresult));

and the order was ignored.

I noticed it when I actually iterated and printed the result set :

$newresult = array();
foreach($notormresult as $r){$newresult[]=iterator_to_array($r);}
print_r($newresult);

Not sure if this is your issue tho as your getting a count mismatch.

zeedre
  • 411
  • 5
  • 8