本文整理汇总了PHP中Service::setDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::setDescription方法的具体用法?PHP Service::setDescription怎么用?PHP Service::setDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service::setDescription方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fromXml
/**
* Get this object from XML
* @internal
*
* @param \SimpleXMLElement $xml
*
* @return Service
*/
public static function fromXml(\SimpleXMLElement $xml)
{
$service = new Service();
$service->setIsResponse();
$service->setCode($xml->Code);
if (isset($xml->Description)) {
$service->setDescription($xml->Description);
}
return $service;
}
示例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;
}
//.........这里部分代码省略.........
示例3: Exception
$doctrineSe->setMonitored(false);
}
// Set the scope
if ((string) $xmlSe->SCOPE == "EGI") {
$doctrineSe->addScope($egiScope);
} else {
if ((string) $xmlSe->SCOPE == 'Local') {
$doctrineSe->addScope($localScope);
} else {
throw new Exception("Unknown scope " . $xmlSe->SCOPE . " for SE " . $xmlSe->HOSTNAME);
}
}
//set creation date
$creationDate = new \DateTime("now", new DateTimeZone('UTC'));
$doctrineSe->setCreationDate($creationDate);
$doctrineSe->setDn((string) $xmlSe->HOSTDN);
$doctrineSe->setIpAddress((string) $xmlSe->HOST_IP);
$doctrineSe->setOperatingSystem((string) $xmlSe->HOST_OS);
$doctrineSe->setArchitecture((string) $xmlSe->HOST_ARCH);
$doctrineSe->setHostName((string) $xmlSe->HOSTNAME);
$doctrineSe->setDescription((string) $xmlSe->DESCRIPTION);
// A service has ELs
$doctrineEndpointLocation = new EndpointLocation();
$doctrineEndpointLocation->setUrl((string) $xmlSe->URL);
$doctrineEndpointLocation->setName('sampleEndpoint');
$doctrineEndpointLocation->setInterfaceName((string) $doctrineSe->getServiceType()->getName());
$doctrineSe->addEndpointLocationDoJoin($doctrineEndpointLocation);
$entityManager->persist($doctrineSe);
$entityManager->persist($doctrineEndpointLocation);
}
$entityManager->flush();