Closed systamonster closed 11 years ago
Not related with this issue, but just to let you know - it's not good to use getRows and get all rows parsed in some temporary variable. That takes much resources (like RAM and also execution speed).
Better approach is to use iterators and parse records one by one directly from database, like this:
$m_product = $this->add('Model_pageproduct')->addCondition('page_id', '1')->setOrder('ord');
foreach($m_product as $row){
// Preferred: you can use $m_product as Model object which have 1 record loaded in it. In next iteration it'll be next record etc.
if($m_product->isFoo()) echo 'Foo product: '.$m_product['name'];
// Useful in some cases: you can use $row as a simple array (not object!) with current record data
if($row['price']>100) echo 'Costly product: '.$row['price'];
...
}
DarkSide666 thank you for your suggestion, I will try! Best regards, Kirill
If the model have some child tables then table name must be espicicate for id field.