public function testExchangeArraySetsPropertiesCorrectly() { $trade = new Application_Model_Trade(); $data = array('trade_id' => '123', 'execution_date' => date('2010-03-01'), 'price' => 3.5); $trade->exchangeArray($data); $this->assertSame($data['trade_id'], $trade->trade_id, '"trade_id" was not set correctly'); $this->assertSame($data['execution_date'], $trade->execution_date, '"execution_date" was not set correctly'); $this->assertSame($data['price'], $trade->price, '"price" was not set correctly'); $this->assertNull($trade->eff_date, '"eff_date" should have defaulted to null'); $this->assertNull($trade->currency, '"currency" should have defaulted to null'); $this->assertNull($trade->inst_type, '"inst_type" should have defaulted to null'); }
/** * returns a filtered set of results. Default ordering * is descending by execution date. * * @param Zend_Db_Table_Select $select * * @access protected */ public function fetchSome(Zend_Db_Table_Select $select) { $rowset = $this->getDbTable()->fetchAll($select); $trades = array(); foreach ($rowset as $row) { $trade = new Application_Model_Trade(); $trade->exchangeArray($row); $trades[] = $trade; } return $trades; }