当前位置: 首页>>代码示例>>PHP>>正文


PHP BaseObject类代码示例

本文整理汇总了PHP中BaseObject的典型用法代码示例。如果您正苦于以下问题:PHP BaseObject类的具体用法?PHP BaseObject怎么用?PHP BaseObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BaseObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: shouldConsumeCreatedEvent

 public function shouldConsumeCreatedEvent(BaseObject $object)
 {
     if ($object instanceof entry && $object->getSource() == VelocixPlugin::getEntrySourceTypeCoreValue(VelocixLiveEntrySourceType::VELOCIX_LIVE)) {
         return true;
     }
     return false;
 }
开发者ID:DBezemer,项目名称:server,代码行数:7,代码来源:kVelocixLiveFlowManager.php

示例2: 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

示例3: 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();
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:33,代码来源:kDropFolderFileResource.php

示例4: objectAdded

 public function objectAdded(BaseObject $object, BatchJob $raisedJob = null)
 {
     /* @var $object ExternalMediaEntry */
     $object->setStatus(entryStatus::READY);
     $object->save();
     return true;
 }
开发者ID:DBezemer,项目名称:server,代码行数:7,代码来源:ExternalMediaCreatedHandler.php

示例5: shouldConsumeCreatedEvent

 public function shouldConsumeCreatedEvent(BaseObject $object)
 {
     if ($object instanceof BatchJob && $object->getJobType() == BatchJobType::BULKUPLOAD) {
         return true;
     }
     return false;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:7,代码来源:kBatchJobLogManager.php

示例6: shouldConsumeCreatedEvent

 public function shouldConsumeCreatedEvent(BaseObject $object)
 {
     if ($object instanceof thumbAsset && $object->getStatus() == asset::FLAVOR_ASSET_STATUS_READY) {
         return true;
     }
     return false;
 }
开发者ID:DBezemer,项目名称:server,代码行数:7,代码来源:kAvnFlowManager.php

示例7: 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;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:12,代码来源:kContentDistributionObjectCopiedHandler.php

示例8: deleteByObject

 public static function deleteByObject(BaseObject $object)
 {
     $c = new Criteria();
     $c->add(sfApprovalPeer::APPROVABLE_ID, $object->getPrimaryKey());
     $c->add(sfApprovalPeer::APPROVABLE_MODEL, get_class($object));
     $approval = sfApprovalPeer::doDelete($c);
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:7,代码来源:PluginsfApprovalPeer.php

示例9: shouldConsumeCreatedEvent

 public function shouldConsumeCreatedEvent(BaseObject $object)
 {
     if ($object instanceof entry && $object->getSource() == LimeLightPlugin::getEntrySourceTypeCoreValue(LimeLightLiveEntrySourceType::LIMELIGHT_LIVE)) {
         return true;
     }
     return false;
 }
开发者ID:DBezemer,项目名称:server,代码行数:7,代码来源:kLimeLightLiveFlowManager.php

示例10: populateFromObject

 /**
  * Populates version properties and creates necessary entries in the resource_attribute_version table.
  * 
  * @param      BaseObject    $resource
  * @param      Array         $withObjects      Optional list of object classes to create and attach to the current resource
  */
 public function populateFromObject(BaseObject $resource, $withObjects = array(), $withVersion = true)
 {
     $this->setResourceId($resource->getPrimaryKey());
     $this->setResourceName(get_class($resource));
     if ($withVersion) {
         $this->setNumber($resource->getVersion());
     }
     foreach ($resource->getPeer()->getFieldNames() as $attribute_name) {
         $getter = sprintf('get%s', $attribute_name);
         $attribute_version = new ResourceAttributeVersion();
         $attribute_version->setAttributeName($attribute_name);
         $attribute_version->setAttributeValue($resource->{$getter}());
         $this->addResourceAttributeVersion($attribute_version);
     }
     foreach ($withObjects as $resourceName) {
         $getter = sprintf('get%s', $resourceName);
         $relatedResources = $resource->{$getter}();
         if (!is_array($relatedResources)) {
             $relatedResources = array($relatedResources);
         }
         foreach ($relatedResources as $relatedResource) {
             $resourceVersion = new ResourceVersion();
             $resourceVersion->populateFromObject($relatedResource, array(), false);
             $this->addResourceVersionRelatedByResourceVersionId($resourceVersion);
         }
     }
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:33,代码来源:ResourceVersion.php

示例11: 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

示例12: shouldConsumeChangedEvent

 public function shouldConsumeChangedEvent(BaseObject $object, array $modifiedColumns)
 {
     if ($object instanceof LiveEntry && in_array(entryPeer::CUSTOM_DATA, $modifiedColumns) && $object->isCustomDataModified(null, 'mediaServers')) {
         return true;
     }
     return false;
 }
开发者ID:DBezemer,项目名称:server,代码行数:7,代码来源:kEventCuePointConsumer.php

示例13: shouldConsumeCreatedEvent

 public function shouldConsumeCreatedEvent(BaseObject $object)
 {
     if ($object instanceof flavorParamsOutputWrap && $object->getType() == WidevinePlugin::getAssetTypeCoreValue(WidevineAssetType::WIDEVINE_FLAVOR) && $this->shouldSyncWidevineRepositoryForPartner($object->getPartnerId())) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:kubrickfr,项目名称:server,代码行数:8,代码来源:kWidevineEventsConsumer.php

示例14: __construct

 /**
  * @param array $entity
  * @param BaseObject $caller
  */
 public function __construct(array $entity, BaseObject $caller)
 {
     $this->entity = array("type" => $entity["type"], "id" => $entity["id"], "xml_id" => $entity["xml_id"]);
     $this->caller = $caller;
     $this->forum = $caller->getForum();
     $this->initPermission();
     $this->editOwn = \COption::GetOptionString("forum", "USER_EDIT_OWN_POST", "Y") == "Y";
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:12,代码来源:entity.php

示例15: objectCreated

 public function objectCreated(BaseObject $fromObject)
 {
     if ($fromObject instanceof entry) {
         $liveEntryId = $fromObject->getRootEntryId();
         $this->copyLiveMetadata($fromObject, $liveEntryId);
     }
     return true;
 }
开发者ID:DBezemer,项目名称:server,代码行数:8,代码来源:kMetadataObjectCreatedHandler.php


注:本文中的BaseObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。