本文整理汇总了PHP中Record::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Record::load方法的具体用法?PHP Record::load怎么用?PHP Record::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Record
的用法示例。
在下文中一共展示了Record::load方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLoadThrowsExceptionIfNothingSetExplicitlyAndDoesntExistInDatabase
public function testLoadThrowsExceptionIfNothingSetExplicitlyAndDoesntExistInDatabase()
{
$record = new Record(array('id' => 4, 'name' => 'test'), $this->dao, false);
$this->dao->expects($this->any())->method('getAttributes')->will($this->returnValue(array('id' => Dao::INT, 'name' => Dao::STRING)));
$this->setExpectedException('RecordException', 'You tried to load a Record which had not attributes set.');
$record->load();
}
示例2: saveAndLoad
public function saveAndLoad(Record $record)
{
$record->save();
$loadedRecord = Record::load($record->getTableName(), $record->getId(), get_class($record));
foreach ($record->getAttributes() as $key => $value) {
$this->assertEquals($value, $loadedRecord->{$key});
}
$record->delete();
}
示例3: load
public function load($iGenreID)
{
$oCon = new Connection();
$sSQL = "SELECT GenreID, GenreName, DisplayOrder \n\t\t\tFROM tbgenres \n\t\t\tWHERE GenreID = " . $iGenreID;
$oResultSet = $oCon->query($sSQL);
$aRow = $oCon->fetchArray($oResultSet);
$this->iGenreID = $aRow['GenreID'];
$this->sGenreName = $aRow['GenreName'];
$this->iDisplayOrder = $aRow['DisplayOrder'];
$sSQL = "SELECT RecordID\n\t\t\tFROM tbrecords \n\t\t\tWHERE GenreID = " . $iGenreID;
$oResultSet = $oCon->query($sSQL);
while ($aRow = $oCon->fetchArray($oResultSet)) {
$iRecordID = $aRow["RecordID"];
$oRecord = new Record();
$oRecord->load($iRecordID);
$this->aRecords[] = $oRecord;
}
$oCon->close();
}
示例4: renderCart
public static function renderCart($oCart)
{
$sHTML = '<table class="cart">';
$sHTML .= ' <tr>
<th>Artist</th>
<th>Title</th>
<th>Price</th>
<th>RecordID</th>
<th>Quantity</th>
</tr>';
$aContents = $oCart->contents;
// echo "<pre>";
// print_r($aContents);
// echo "</pre>";
foreach ($aContents as $iRecordID => $iQuantity) {
$oRecord = new Record();
$oRecord->load($iRecordID);
$sHTML .= ' <tr>
<td>' . $oRecord->Artist . '</td>
<td>' . $oRecord->Title . '</td>
<td>' . $oRecord->Price . '</td>
<td>' . $oRecord->RecordID . '</td>
<td>' . $iQuantity . '</td>
<td class="remove"><a href="removeFromCart.php?RecordID=' . $oRecord->RecordID . '">x</a>
</tr>';
}
$sHTML .= '</table>';
return $sHTML;
}