The following code fails throws a Zend_Controller_Exception (“Invalid value passed to setPost(); must be either array of values or key/value pair”)
/** Model_Audit_Luminaire */
$luminaireModel = new Model_Audit_Luminaire();
if (!$fixture = $luminaireModel->getScheduleItem($scheduleId)) {
$this->fail('Could not retrieve fixture from database');
}
$fixtureArray = $fixture->toArray();
$this->getRequest()
->setMethod('POST')
->setPost($fixtureArray);
I did a var_dump() to ensure $fixtureArray was the correct type, and formatted properly…no visible problems.
Are any of the columns in your schedule item row nullable?
The
setPost()method calls itself for each key/value pair you pass in an array. But if any value is null, it throws an exception.You may have to loop over the array and
setPost()only values that are non-null:Or else ensure that the row you fetch from the database in your
getScheduleItem()method contains no nulls.