本文整理汇总了PHP中BaseObject::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseObject::getId方法的具体用法?PHP BaseObject::getId怎么用?PHP BaseObject::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseObject
的用法示例。
在下文中一共展示了BaseObject::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyMetadata
/**
* @param KalturaMetadataObjectType $objectType
* @param BaseObject $fromObject
* @param BaseObject $toObject
*/
protected function copyMetadata($objectType, BaseObject $fromObject, BaseObject $toObject)
{
KalturaLog::debug("Copy metadata type [{$objectType}] from " . get_class($fromObject) . '[' . $fromObject->getId() . "] to[" . $toObject->getId() . "]");
$c = new Criteria();
$c->add(MetadataPeer::OBJECT_TYPE, $objectType);
$c->add(MetadataPeer::OBJECT_ID, $fromObject->getId());
$metadatas = MetadataPeer::doSelect($c);
foreach ($metadatas as $metadata) {
$newMetadata = $metadata->copy();
$newMetadata->setObjectId($toObject->getId());
if ($toObject instanceof Partner) {
$newMetadata->setPartnerId($toObject->getId());
} else {
$newMetadata->setPartnerId($toObject->getPartnerId());
}
$metadataProfileId = kObjectCopyHandler::getMappedId('MetadataProfile', $metadata->getMetadataProfileId());
if ($metadataProfileId) {
$metadataProfile = MetadataProfilePeer::retrieveByPK($metadataProfileId);
if ($metadataProfile) {
$newMetadata->setMetadataProfileId($metadataProfileId);
$newMetadata->setMetadataProfileVersion($metadataProfile->getVersion());
}
}
$newMetadata->save();
kFileSyncUtils::createSyncFileLinkForKey($newMetadata->getSyncKey(Metadata::FILE_SYNC_METADATA_DATA), $metadata->getSyncKey(Metadata::FILE_SYNC_METADATA_DATA));
}
}
示例2: getKey
public function getKey()
{
if (method_exists($this->toObject, 'getId')) {
return get_class($this->object) . $this->toObject->getId();
}
return null;
}
示例3: calculateCrumb
protected function calculateCrumb(BaseObject $object)
{
$parentId = $object->getParentId();
if (!$parentId) {
$this->crumbsByObjectId[$object->getId()] = array($object->getName());
return $this->crumbsByObjectId[$object->getId()];
}
if (isset($this->crumbsByObjectId[$parentId])) {
$this->crumbsByObjectId[$object->getId()] = $this->crumbsByObjectId[$parentId];
$this->crumbsByObjectId[$object->getId()][] = $object->getName();
return $this->crumbsByObjectId[$object->getId()];
}
$storage = $object->getStorage();
$fake = Driver::getInstance()->getFakeSecurityContext();
$this->crumbsByObjectId[$object->getId()] = array();
foreach ($object->getParents($fake, array('select' => array('ID', 'NAME', 'TYPE')), SORT_DESC) as $parent) {
if ($parent->getId() == $storage->getRootObjectId()) {
continue;
}
$this->crumbsByObjectId[$object->getId()][] = $parent->getName();
}
unset($parent);
$this->crumbsByObjectId[$parentId] = $this->crumbsByObjectId[$object->getId()];
$this->crumbsByObjectId[$object->getId()][] = $object->getName();
return $this->crumbsByObjectId[$object->getId()];
}
示例4: doConsume
/**
* @param kObjectSavedEventConsumer $consumer
* @return bool true if should continue to the next consumer
*/
protected function doConsume(KalturaEventConsumer $consumer)
{
if (!$consumer->shouldConsumeSavedEvent($this->object)) {
return true;
}
$additionalLog = '';
if (method_exists($this->object, 'getId')) {
$additionalLog .= 'id [' . $this->object->getId() . ']';
}
KalturaLog::debug(get_class($this) . ' event consumed by ' . get_class($consumer) . ' object type [' . get_class($this->object) . '] ' . $additionalLog);
return $consumer->objectSaved($this->object);
}
示例5: doConsume
/**
* @param kObjectSavedEventConsumer $consumer
* @return bool true if should continue to the next consumer
*/
protected function doConsume(KalturaEventConsumer $consumer)
{
if (!$consumer->shouldConsumeSavedEvent($this->object)) {
return true;
}
$additionalLog = '';
if (method_exists($this->object, 'getId')) {
$additionalLog .= 'id [' . $this->object->getId() . ']';
}
KalturaLog::debug('consumer [' . get_class($consumer) . '] started handling [' . get_class($this) . '] object type [' . get_class($this->object) . '] ' . $additionalLog);
$result = $consumer->objectSaved($this->object);
KalturaLog::debug('consumer [' . get_class($consumer) . '] finished handling [' . get_class($this) . '] object type [' . get_class($this->object) . '] ' . $additionalLog);
return $result;
}
示例6: getRecommendations
/**
* Returns recommended objects which the user has not rated based on his/her
* rating of other objects.
*
* This implementation is based on the
* OpenSlopeOne project by Chaoqun Fu, http://code.google.com/p/openslopeone/.
*
* @param BaseObject $object The user for which to return the recommendations
* @param string $model The name of the class for which to return recommendations
* @param int $limit The number of recommendation objects which should be returned.
* Use NULL for returning all recommended objects
* @return array of sfRecommendationObject objects which wrap the recommended objects
*/
public function getRecommendations(BaseObject $object, $model, $limit = NULL)
{
$parser = new sfPropelSlopeOneSqlParser();
$slopeQuery = 'SELECT sf_slope_one.item2_id AS id,
SUM((%ratings%.%rating% * sf_slope_one.times) - sf_slope_one.rating)/
SUM(sf_slope_one.times) AS rating
FROM sf_slope_one, %ratings%
WHERE %ratings%.%rater_id% = :rater_id AND
%ratings%.%rateable_model% = :item_model AND
%ratings%.%rateable_id% = sf_slope_one.item1_id AND
%ratings%.%rateable_model% = sf_slope_one.item1_model AND
sf_slope_one.item2_id NOT IN (SELECT %ratings%.%rateable_id%
FROM %ratings%
WHERE %ratings%.%rater_id% = :rater_id)
GROUP BY item2_id
ORDER BY rating DESC';
$slopeQuery .= isset($limit) ? ' LIMIT ' . $limit : '';
$connection = Propel::getConnection();
$statement = $connection->prepare($parser->parse($slopeQuery));
$statement->execute(array('rater_id' => $object->getId(), 'item_model' => $model));
$ratings = array();
while ($result = $statement->fetch()) {
$ratings[$result['id']] = $result['rating'];
}
$modelObject = new $model();
$objects = call_user_func(array(get_class($modelObject->getPeer()), 'retrieveByPKs'), array_keys($ratings));
foreach ($objects as &$object) {
$object = new sfSlopeOneRecommendation($object, $ratings[$object->getId()]);
}
return $objects;
}
开发者ID:kasperg,项目名称:symfony-propel-slope-one-recommendations-plugin,代码行数:44,代码来源:sfPropelActAsSlopeOneRaterBehavior.php
示例7: attachCreatedObject
/**
* @param BaseObject $object
*/
public function attachCreatedObject(BaseObject $object)
{
$dropFolderFile = DropFolderFilePeer::retrieveByPK($this->getDropFolderFileId());
$dropFolder = DropFolderPeer::retrieveByPK($dropFolderFile->getDropFolderId());
$entryId = $asset = null;
// create import job for remote drop folder files
if ($dropFolder instanceof RemoteDropFolder) {
// get params
if ($object instanceof asset) {
$entryId = $object->getEntryId();
$asset = $object;
} else {
if ($object instanceof entry) {
$entryId = $object->getId();
$asset = null;
} else {
return;
}
}
$importUrl = $dropFolder->getFolderUrl();
$importUrl .= '/' . $dropFolderFile->getFileName();
$jobData = $dropFolder->getImportJobData();
$jobData->setDropFolderFileId($this->getDropFolderFileId());
// add job
kJobsManager::addImportJob(null, $entryId, $dropFolderFile->getPartnerId(), $importUrl, $asset, $dropFolder->getFileTransferMgrType(), $jobData);
// set file status to DOWNLOADING
$dropFolderFile->setStatus(DropFolderFileStatus::DOWNLOADING);
$dropFolderFile->save();
}
}
示例8: getRecommendations
/**
* Returns objects of the same class and with similar ratings as the current rateable object.
*
* This implementation is based on the
* OpenSlopeOne project by Chaoqun Fu, http://code.google.com/p/openslopeone/.
*
* @param BaseObject $object The rateable object for which to return other recommended object
* @param int $limit The number of recommendation objects which should be returned. Use NULL for returning all recommended objects
* @return array of sfRecommendationObject objects which wrap the recommended objects
*/
public function getRecommendations(BaseObject $object, $limit = NULL)
{
$parser = new sfPropelSlopeOneSqlParser();
$slopeQuery = 'SELECT item2_id AS id,
SUM(rating/times) AS rating
FROM sf_slope_one
WHERE item1_id = :item_id AND
item1_model = :item_model AND
item1_model = item2_model
GROUP BY item2_id
ORDER BY rating DESC';
$slopeQuery .= isset($limit) ? ' LIMIT ' . $limit : '';
$connection = Propel::getConnection();
$statement = $connection->prepare($parser->parse($slopeQuery));
$statement->execute(array('item_id' => $object->getId(), 'item_model' => get_class($object)));
$ratings = array();
while ($result = $statement->fetch()) {
$ratings[$result['id']] = $result['rating'];
}
$objects = call_user_func(array(get_class($object->getPeer()), 'retrieveByPKs'), array_keys($ratings));
foreach ($objects as &$object) {
$object = new sfSlopeOneRecommendation($object, $ratings[$object->getId()]);
}
return $objects;
}
开发者ID:kasperg,项目名称:symfony-propel-slope-one-recommendations-plugin,代码行数:35,代码来源:sfPropelActAsSlopeOneRateableBehavior.php
示例9: objectAdded
/**
* @param BaseObject $object
* @return bool true if should continue to the next consumer
*/
public function objectAdded(BaseObject $object)
{
if (!$object instanceof FileSync || $object->getStatus() != FileSync::FILE_SYNC_STATUS_PENDING || $object->getFileType() != FileSync::FILE_SYNC_FILE_TYPE_FILE || $object->getDc() == kDataCenterMgr::getCurrentDcId()) {
return true;
}
$c = new Criteria();
$c->addAnd(FileSyncPeer::OBJECT_ID, $object->getObjectId());
$c->addAnd(FileSyncPeer::VERSION, $object->getVersion());
$c->addAnd(FileSyncPeer::OBJECT_TYPE, $object->getObjectType());
$c->addAnd(FileSyncPeer::OBJECT_SUB_TYPE, $object->getObjectSubType());
$c->addAnd(FileSyncPeer::ORIGINAL, '1');
$original_filesync = FileSyncPeer::doSelectOne($c);
if (!$original_filesync) {
KalturaLog::err('Original filesync not found for object_id[' . $object->getObjectId() . '] version[' . $object->getVersion() . '] type[' . $object->getObjectType() . '] subtype[' . $object->getObjectSubType() . ']');
return true;
}
$sourceFileUrl = $original_filesync->getExternalUrl();
if (!$sourceFileUrl) {
KalturaLog::err('External URL not found for filesync id [' . $object->getId() . ']');
return true;
}
$job = kMultiCentersManager::addFileSyncImportJob($this->getEntryId($object), $object->getPartnerId(), $object->getId(), $sourceFileUrl);
$job->setDc($object->getDc());
$job->save();
return true;
}
示例10: objectCopied
/**
* @param BaseObject $fromObject
* @param BaseObject $toObject
* @return bool true if should continue to the next consumer
*/
public function objectCopied(BaseObject $fromObject, BaseObject $toObject)
{
if ($fromObject instanceof Partner) {
$this->copyDistributionProfiles($fromObject->getId(), $toObject->getId());
}
return true;
}
示例11: execute
/**
* Execute method reload
*
* @param string $request
* @return array
* @author Łukasz Wojciechowski
*/
public function execute($request)
{
if ($request->isMethod('post')) {
if ($this->processPostData()) {
$result = array('success' => true, 'message' => "Saved with success!", 'redirect' => $this->widgetUri . '?id=' . $this->object->getId());
return $result;
}
}
}
示例12: objectDeleted
public function objectDeleted(BaseObject $object, BatchJob $raisedJob = null)
{
$shortLinks = ShortLinkPeer::retrieveByKuserId($object->getId());
foreach ($shortLinks as $shortLink) {
$shortLink->setStatus(ShortLinkStatus::DELETED);
$shortLink->save();
}
return true;
}
示例13: objectCreated
public function objectCreated(BaseObject $object)
{
/* @var $object entry */
$partner = $object->getPartner();
$velocixLiveParamsJSON = json_decode($partner->getLiveStreamProvisionParams());
if (!isset($velocixLiveParamsJSON->velocix) || !isset($velocixLiveParamsJSON->velocix->userName) || !isset($velocixLiveParamsJSON->velocix->password)) {
$object->setStatus(entryStatus::ERROR_IMPORTING);
$object->save();
return true;
}
if (isset($velocixLiveParamsJSON->velocix->streamNamePrefix)) {
$object->setStreamName($velocixLiveParamsJSON->velocix->streamNamePrefix . '_' . $object->getId());
} else {
$object->setStreamName($object->getId());
}
$object->save();
return true;
}
示例14: objectDeleted
public function objectDeleted(BaseObject $object, BatchJob $raisedJob = null)
{
if ($object instanceof entry) {
$this->entryDeleted($object->getId());
}
if ($object instanceof CuePoint) {
$this->cuePointDeleted($object);
}
return true;
}
示例15: contribute
public function contribute(BaseObject $object, SimpleXMLElement $mrss, kMrssParameters $mrssParams = null)
{
if (!$object instanceof entry) {
return;
}
$entryDistributions = EntryDistributionPeer::retrieveByEntryId($object->getId());
foreach ($entryDistributions as $entryDistribution) {
$this->contributeDistribution($entryDistribution, $mrss);
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:10,代码来源:kContentDistributionMrssManager.php