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


PHP Subscription::setMaster方法代码示例

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


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

示例1: Channel

 if ($data['owner'] == $session->user && $certificate['owner'] == $session->user) {
     // create the channel
     $channel = new Channel($form->inputId);
     $channel->setCertificate($form->inputCertificate);
     $channel->setApplication($form->inputApplicationId);
     $channel->setLabel($form->inputLabel);
     $channel->setDescription($form->inputDescription);
     $channel->setDefaultPermissions((int) $form->inputRead | (int) $form->inputWrite | (int) $form->inputDelete);
     // channel owner gets all permissions by default
     $certificate = $channel->generate_certificate(RenegadeConstants::kPermissionRead | RenegadeConstants::kPermissionWrite | RenegadeConstants::kPermissionDelete);
     $metadata = $channel->generate_metadata();
     $subscription = new Subscription();
     $subscription->setCertificate($certificate['key']);
     $subscription->setApplication($metadata['application']);
     $subscription->setChannel($metadata['_id']);
     $subscription->setMaster(true);
     // place us in the application db context
     $options = array('default' => Renegade::databaseForId($form->inputApplicationId));
     $channels = Renegade::database(RenegadeConstants::kDatabaseMongoDB, RenegadeConstants::kDatabaseChannels, $options);
     $subscriptions = Renegade::database(RenegadeConstants::kDatabaseMongoDB, RenegadeConstants::kDatabaseSubscriptions, $options);
     $redis->set($certificate['key'], $certificate['value']);
     $channels->insert($metadata);
     $subscriptions->insert($subscription->toArray());
 } else {
     // error, something is potentially wrong, either from the user or the system
     // lets assume the system, it's easy to throw guilt at the user =)
     echo 'Error';
     exit;
     header('Location: /applications');
     exit;
 }
开发者ID:aventurella,项目名称:Galaxy,代码行数:31,代码来源:channelCreate.php

示例2: Channel

                 */
                 // we are giving the fully qualified channel id here
                 // so we will not need to set the application, it will be done for us
                 $channel = new Channel($remote_channel['_id']);
                 $channel->setCertificate($application['certificate']);
                 $channel->setLabel($remote_channel['label']);
                 $channel->setDescription($remote_channel['description']);
                 $channel->setDefaultPermissions($remote_channel['defaultPermissions']);
                 $certificate = $channel->generate_certificate($remote_channel['defaultPermissions']);
                 $metadata = $channel->generate_metadata();
                 $metadata['requests'] = $remote_channel['requests'];
                 $subscription = new Subscription();
                 $subscription->setCertificate($certificate['key']);
                 $subscription->setApplication($form->inputApplicationId);
                 $subscription->setChannel($metadata['_id']);
                 $subscription->setMaster(false);
                 $db_remote_options = array('default' => Renegade::databaseForId($remote_application));
                 $db_remote_subscriptions = Renegade::database(RenegadeConstants::kDatabaseMongoDB, RenegadeConstants::kDatabaseSubscriptions, $db_remote_options);
                 $certificates = Renegade::database(RenegadeConstants::kDatabaseRedis, RenegadeConstants::kDatabaseCertificates);
                 $db_remote_subscriptions->insert($subscription->toArray());
                 $db_channels->insert($metadata);
                 $certificates->set($certificate['key'], $certificate['value']);
                 // All Done
                 Renegade::redirect('/applications/' . $form->inputApplicationId . '/channels');
             }
         } else {
             echo 'channel not found';
             //Renegade::redirect('/applications/'.$form->inputApplicationId.'./channels');
         }
     }
 }
开发者ID:aventurella,项目名称:Galaxy,代码行数:31,代码来源:channelSubscribe.php


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