本文整理汇总了PHP中Record::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Record::getId方法的具体用法?PHP Record::getId怎么用?PHP Record::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Record
的用法示例。
在下文中一共展示了Record::getId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: executeEdit
/**
* Edit
*/
public function executeEdit()
{
if ($this->isGET()) {
return $this->renderJson(array("success" => false, "info" => "POST only."));
} else {
$ids = array();
foreach ($this->getRequestParameter('record') as $data) {
if (!($record = RecordPeer::retrieveByPK($data['id']))) {
$record = new Record();
$record->setDomainId($this->domain->getId());
}
$record->setName($data['name']);
$record->setType($data['type']);
$record->setContent($data['content']);
$record->setTtl($data['ttl']);
if ($data['type'] == 'MX' || $data['type'] == 'SRV') {
$record->setPrio($data['prio']);
}
$record->save();
$ids[] = $record->getId();
}
$c = new Criteria();
$c->add(RecordPeer::DOMAIN_ID, $this->domain->getId());
$c->add(RecordPeer::ID, $ids, Criteria::NOT_IN);
foreach (RecordPeer::doSelect($c) as $record) {
$record->delete();
}
return $this->renderJson(array("success" => true, "info" => "Domain updated."));
}
}
示例3: testSerialize
public function testSerialize()
{
$record = new Record('foo', array('id' => 1, 'title' => 'bar'));
$this->assertEquals(1, $record->getId());
$this->assertEquals('bar', $record->getTitle());
$record = unserialize(serialize($record));
$this->assertEquals(1, $record->getId());
$this->assertEquals('bar', $record->getTitle());
}
示例4: generateDisplayForPartStructures
/**
* Generate HTML for displaying particular parts of the Record
*
* @param object $record The record to print.
* @param array $partStructures An array of particular partStructures to print.
* @return string
* @access public
* @since 10/19/04
*/
function generateDisplayForPartStructures(Id $repositoryId, Id $assetId, Record $record, array $partStructures)
{
ArgumentValidator::validate($partStructures, new ArrayValidatorRuleWithRule(new ExtendsValidatorRule("PartStructure")));
$partIterator = $record->getParts();
$parts = array();
while ($partIterator->hasNext()) {
$part = $partIterator->next();
$partStructure = $part->getPartStructure();
$partStructureId = $partStructure->getId();
if (!isset($parts[$partStructureId->getIdString()]) || !is_array($parts[$partStructureId->getIdString()])) {
$parts[$partStructureId->getIdString()] = array();
}
$parts[$partStructureId->getIdString()][] = $part;
}
// print out the parts;
ob_start();
$partStructuresToSkip = array('FILE_DATA', 'THUMBNAIL_DATA', 'THUMBNAIL_MIME_TYPE', 'THUMBNAIL_DIMENSIONS');
$printThumbnail = FALSE;
foreach (array_keys($partStructures) as $key) {
$partStructure = $partStructures[$key];
$partStructureId = $partStructure->getId();
if (!in_array($partStructureId->getIdString(), $partStructuresToSkip)) {
print "\n<strong>" . $partStructure->getDisplayName() . ":</strong> \n";
switch ($partStructureId->getIdString()) {
case 'FILE_SIZE':
$size = ByteSize::withValue($parts[$partStructureId->getIdString()][0]->getValue());
print $size->asString();
break;
case 'DIMENSIONS':
$dimensionArray = $parts[$partStructureId->getIdString()][0]->getValue();
print "<em>" . _('width: ') . "</em>" . $dimensionArray[0] . 'px<em>;</em> ';
print "<em>" . _('height: ') . "</em>" . $dimensionArray[1] . 'px';
break;
default:
print $parts[$partStructureId->getIdString()][0]->getValue();
}
print "\n<br />";
} else {
$printThumbnail = TRUE;
}
}
$html = ob_get_clean();
$harmoni = Harmoni::instance();
$harmoni->request->startNamespace("polyphony-repository");
if ($printThumbnail) {
ob_start();
$recordId = $record->getId();
$ns = $harmoni->request->endNamespace();
// ======= VIEWER LINK ======== //
$xmlAssetIdString = $harmoni->request->get("asset_id");
print "<a href='#' onclick='Javascript:window.open(";
print '"' . VIEWER_URL . "?&source=";
print urlencode($harmoni->request->quickURL("asset", "browserecordxml", array("collection_id" => $repositoryId->getIdString(), "asset_id" => $xmlAssetIdString, "record_id" => $recordId->getIdString(), RequestContext::name("limit_by") => RequestContext::value("limit_by"), RequestContext::name("type") => RequestContext::value("type"), RequestContext::name("searchtype") => RequestContext::value("searchtype"), RequestContext::name("searchstring") => RequestContext::value("searchstring"))));
print '&start=0", ';
print '"' . preg_replace("/[^a-z0-9]/i", '_', $assetId->getIdString()) . '", ';
print '"toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=500"';
print ")'>";
$harmoni->request->startNamespace($ns);
// If we have a thumbnail with a valid mime type, print a link to that.
$thumbnailName = preg_replace("/\\.[^\\.]+\$/", "", $parts['FILE_NAME'][0]->getValue());
if ($thumbnailMimeType = $parts['THUMBNAIL_MIME_TYPE'][0]->getValue()) {
$mime = Services::getService("MIME");
$thumbnailName .= "." . $mime->getExtensionForMIMEType($thumbnailMimeType);
}
print "\n<img src='";
print RepositoryInputOutputModuleManager::getThumbnailUrlForRecord($assetId, $record);
print "'";
print " style='border: 0px;'";
print " alt='Thumbnail image.'";
print " align='left'";
print " />";
print "</a> <br />";
$html2 = ob_get_clean();
ob_start();
print "\n<a href='";
print RepositoryInputOutputModuleManager::getFileUrlForRecord($assetId, $record);
print "' target='_blank'>";
print "Download This File</a>\n";
$downloadlink = ob_get_clean();
$html = "<table border=0><tr><td>" . $html2 . "</td><td>" . $html . $downloadlink . "</td></tr></table>";
}
$harmoni->request->endNamespace();
return $html;
}