Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-27-2007, 06:59 PM
Junior Member
 
Join Date: Nov 2007
Posts: 2
Default Returning Rowset

Hi,
Is it possible to return a rowset instead of array with direct queries?
I have these classes under models directory.(in one file)

<?php
class Products extends Zend_Db_Table_Abstract{
protected $_name = 'Products';
protected $_primary = 'productID';
protected $_rowClass = 'Product';

function loadIndexProducts($pCategory){
$sql = 'SELECT * FROM Products WHERE product_category=? AND productStock=1 ORDER BY rand() LIMIT 0,6';
$return = $this->_db->fetchAll($sql,$pCategory);
return $return;
if I run it like this, it returns array instead of rowset, and so I can't use rowclass below.
}
}
/* Row Class */
class Product extends Zend_Db_Table_Row_Abstract{
public function getProductID(){
return $this->productID;
}
public function getProductCategoryName(){
$categorySet = $this->findDependentRowset('Categories');
$thisCategory = $categorySet->current();
return $thisCategory->categoryName;
}
public function getProductMainPic(){
$pictureSet = $this->findDependentRowset('ProductPictures');
foreach ($pictureSet as $pictureLine){
if ($pictureLine->mainPic == '1'){
return $pictureLine->imageFile;
}
return 'null';
}
}
public function __get($key){
if (method_exists($this,$key)){
return $this->$key();
}
return parent::__get($key);
}
}
?>

Thanks
Bill
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:54 AM.