Static method, Zend_View error

cindy33

New Member
I have a static method 'findAll' on a model which basically gets all rows with certain criteria. This method works fine and I can call it using:\[code\]$m::findAll();\[/code\]Where $m is the model name as a variable. I can output this and it returns correct results. However, when assigning this to a variable in the Zend_View object, as:\[code\]$this->view->viewvariable = $m::findAll();\[/code\]I get the error:\[quote\] Zend_Db_Table_Exception: Too many columns for the primary key\[/quote\]Any ideas why?Find all function:\[code\]final public static function findAll($where = false, array $options = array()) { $object = new static(); if (!empty($options)) $options = array_merge($object->options, $options); else $options = $object->options; $run = $object->buildDefaultSelect($where, $options); $rows = $run->fetchAll(); if ($options['asObject'] == true) { $result = array(); foreach ($rows as $r) { $class = new static(); $class->setInfo($r); $result[] = $class; } return $result; } else { if (count($rows) > 0) return $rows; else return array(); } }\[/code\]Note: This function works fine everywhere apart from when assigning to a view variable. If I run the below (not assigning it to a view variable), it shows the correct array data.\[code\] var_dump($m::findAll($module['where'], $module['options'])); exit;\[/code\]In my view (I have replaced the actual name with viewvariable for the sake of this post):\[code\]<?php foreach($this->viewvariable as $item) { ?>//Do some echoing of data in $item//Close foreach\[/code\]
 
Back
Top