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


PHP Service::setParentSiteDoJoin方法代码示例

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


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

示例1: addServiceDoJoin

 public function addServiceDoJoin(Service $service)
 {
     $this->services[] = $service;
     $service->setParentSiteDoJoin($this);
 }
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:5,代码来源:Site.php

示例2: addService

 /**
  * Array
  * (
  *     [Service_Type] => 21
  *     [EndpointURL] => Testing://host.com
  *     [Scope] => 2
  *     [Hosting_Site] => 377
  *     [SE] => Array
  *     (
  *         [ENDPOINT] => my.new.host.com21
  *         [HOSTNAME] => my.new.host.com
  *         [HOST_IP] => 10.0.0.1
  *         [HOST_DN] => /cn=JCasson
  *         [HOST_IP_V6] => 0000:0000:0000:0000:0000:0000:0000:0000[/int]
  *         [DESCRIPTION] => hithere
  *         [HOST_OS] =>
  *         [HOST_ARCH] =>
  *         [BETA] => Y
  *         [PRODUCTION_LEVEL] => Y
  *         [IS_MONITORED] => Y
  *         [EMAIL] =>
  *     )
  * )
  * @param Array $values Balues for the new SE (defined above)
  * @param org\gocdb\services\User $user The user adding the SE
  */
 public function addService($values, \User $user = null)
 {
     $this->em->getConnection()->beginTransaction();
     // get the parent site
     $dql = "SELECT s from Site s WHERE s.id = :id";
     $site = $this->em->createQuery($dql)->setParameter('id', $values['hostingSite'])->getSingleResult();
     // get the service type
     $st = $this->getServiceType($values['serviceType']);
     $siteService = new \org\gocdb\services\Site();
     $siteService->setEntityManager($this->em);
     if (count($siteService->authorizeAction(\Action::SITE_ADD_SERVICE, $site, $user)) == 0) {
         throw new \Exception("You don't hold a role over {$site}.");
     }
     $this->validate($values['SE'], 'service');
     $this->validateEndpointUrl($values['endpointUrl']);
     $this->uniqueCheck($values['SE']['HOSTNAME'], $st, $site);
     //check there are the required number of scopes specified
     $this->checkNumberOfScopes($values['Scope_ids']);
     // validate production/monitored combination
     if ($st != 'VOMS' && $st != 'emi.ARGUS') {
         if ($values['PRODUCTION_LEVEL'] == "Y" && $values['IS_MONITORED'] != "Y") {
             throw new \Exception("If Production flat is set to True, Monitored flag must also be True (except for VOMS and emi.ARGUS)");
         }
     }
     $se = new \Service();
     try {
         $se->setParentSiteDoJoin($site);
         $se->setServiceType($st);
         // Set production
         if ($values['PRODUCTION_LEVEL'] == "Y") {
             $se->setProduction(true);
         } else {
             $se->setProduction(false);
         }
         // Set Beta
         if ($values['BETA'] == "Y") {
             $se->setBeta(true);
         } else {
             $se->setBeta(false);
         }
         // Set monitored
         if ($values['IS_MONITORED'] == "Y") {
             $se->setMonitored(true);
         } else {
             $se->setMonitored(false);
         }
         // Set the scopes
         foreach ($values['Scope_ids'] as $scopeId) {
             $dql = "SELECT s FROM Scope s WHERE s.id = :id";
             $scope = $this->em->createQuery($dql)->setParameter('id', $scopeId)->getSingleResult();
             $se->addScope($scope);
         }
         $se->setDn($values['SE']['HOST_DN']);
         $se->setIpAddress($values['SE']['HOST_IP']);
         $se->setOperatingSystem($values['SE']['HOST_OS']);
         $se->setArchitecture($values['SE']['HOST_ARCH']);
         $se->setHostName($values['SE']['HOSTNAME']);
         $se->setDescription($values['SE']['DESCRIPTION']);
         $se->setEmail($values['SE']['EMAIL']);
         $se->setUrl($values['endpointUrl']);
         /* With version 5.3 a service does not have to have an endpoint. 
            $el = new \EndpointLocation();
            $el->setUrl($values['endpointUrl']);
            $se->addEndpointLocationDoJoin($el);
            $this->em->persist($el);
            */
         $this->em->persist($se);
         $this->em->flush();
         $this->em->getConnection()->commit();
     } catch (\Exception $e) {
         $this->em->getConnection()->rollback();
         $this->em->close();
         throw $e;
     }
//.........这里部分代码省略.........
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:101,代码来源:ServiceService.php

示例3: Service

    $localScope = $localScope;
}
foreach ($ses as $xmlSe) {
    $doctrineSe = new Service();
    // get the hosting site entity
    $dql = "SELECT s from Site s WHERE s.shortName = ?1";
    $parentSites = $entityManager->createQuery($dql)->setParameter(1, (string) $xmlSe->SITENAME)->getResult();
    /* Error checking: ensure each SE's "parent site" refers to exactly
     * one ngi */
    if (count($parentSites) !== 1) {
        throw new Exception(count($parentSites) . " sites found with short name: " . $xmlSe->SITENAME . ". SE hostname is " . $xmlSe->HOSTNAME);
    }
    foreach ($parentSites as $result) {
        $parentSite = $result;
    }
    $doctrineSe->setParentSiteDoJoin($parentSite);
    // get the hosting service type
    $dql = "SELECT s from ServiceType s WHERE s.name = ?1";
    $sts = $entityManager->createQuery($dql)->setParameter(1, (string) $xmlSe->SERVICE_TYPE)->getResult();
    /* Error checking: ensure each SE's "SERVICE_TYPE" refers to exactly
     * one SERVICE_TYPE */
    if (count($sts) !== 1) {
        throw new Exception(count($sts) . " SERVICE_TYPEs found with name: " . $xmlSe->SERVICE_TYPE);
    }
    foreach ($sts as $st) {
        $st = $st;
    }
    $doctrineSe->setServiceType($st);
    // Set production
    if ((string) $xmlSe->IN_PRODUCTION == "Y") {
        $doctrineSe->setProduction(true);
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:31,代码来源:AddServiceEndpoints.php


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