コード例 #1
0
ファイル: Record.LazyLoading.php プロジェクト: enyo/rincewind
 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
0
 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
0
ファイル: genre.php プロジェクト: wasim01/theRecordBreakers
 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
0
ファイル: view.php プロジェクト: wasim01/theRecordBreakers
    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;
    }