本文整理汇总了PHP中Service::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::getId方法的具体用法?PHP Service::getId怎么用?PHP Service::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service::getId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEntitlementsForPrincipalToService
public function getEntitlementsForPrincipalToService(Principal $p, Service $s)
{
$user = sfContext::getInstance()->getUser();
$eids = array();
$rps = Doctrine::getTable('RolePrincipal')->findByPrincipalId($p->getId());
foreach ($rps as $rp) {
$res = Doctrine::getTable('RoleEntitlement')->findByRoleId($rp->getRoleId());
foreach ($res as $re) {
$eids[] = $re->getEntitlementId();
}
}
$ueids = array_unique($eids);
foreach ($ueids as $ueid) {
$e = Doctrine::getTable('Entitlement')->find($ueid);
// $tmp .= $e->getName()." ".$e->getService()." ".$s->getName()."<br>";
if ($s->isValidated()) {
if ($e->getServiceId() == $s->getId()) {
$es[] = $e;
}
}
}
if (isset($es)) {
return $es;
} else {
//var_dump(array($tmp));exit;
return NULL;
}
}
示例2: testInit
/**
* Тест /robokassa/init
*
*/
public function testInit()
{
$user = $this->helper->makeUser();
//$user->setUserName('Admin');
$this->authenticateUser($user);
$user->save();
$service = new Service();
$service->price = 100;
$service->save();
// Верный запрос
// Ожидаем редирект
$this->browser->post($this->generateUrl('robokassa', array('action' => 'init')), array('service' => $service->getId(), 'term' => 6))->with('request')->begin()->isParameter('service', $service->getId())->isParameter('term', 6)->end()->with('response')->begin()->isStatusCode(200)->matches('/(robokassa)/i')->end();
// Неверный запрос с несуществующим id сервиса
// Ожидаем переброс на 404
$this->browser->post('robokassa/init/', array('service' => time(), 'term' => 6))->with('response')->begin()->isStatusCode(404)->end();
}
示例3: testCascade
/**
* Тест каскадных удалений
*
*/
public function testCascade()
{
$bt = new BillingTransaction();
// Создаем пользователя, услугу и транзакцию
$user = $this->helper->makeUser();
$user->save();
$service = new Service();
$service->save();
$bt->setUserId($user->getId());
$bt->setServiceId($service->getId());
$bt->save();
// При удалении службы транзакция остается
$service->delete();
$findBt = Doctrine::getTable('BillingTransaction')->find($bt->getId());
$this->assertType('BillingTransaction', $findBt);
$this->assertEquals($findBt->getId(), $bt->getId());
// При удалении пользователя удаляется запись о транзакции
$user->delete();
$findBt = Doctrine::getTable('BillingTransaction')->find($bt->getId());
$this->assertEquals($findBt, null);
}
示例4: moveService
public function moveService(\Service $Service, \Site $Site, \User $user = null)
{
//Throws exception if user is not an administrator
$this->checkUserIsAdmin($user);
$this->em->getConnection()->beginTransaction();
//suspend auto-commit
try {
//If the site or service have no ID - throw logic exception
$site_id = $Site->getId();
if (empty($site_id)) {
throw new LogicException('Site has no ID');
}
$Service_id = $Service->getId();
if (empty($Service_id)) {
throw new LogicException('Service has no ID');
}
//find old site
$old_Site = $Service->getParentSite();
//If the Site has changed, then we move the site.
if ($old_Site != $Site) {
//Remove the service from the old site if it has an old site
if (!empty($old_Site)) {
$old_Site->getServices()->removeElement($Service);
}
//Add Service to new Site
$Site->addServiceDoJoin($Service);
//persist
$this->em->merge($Site);
$this->em->merge($old_Site);
}
//close if
$this->em->flush();
$this->em->getConnection()->commit();
} catch (Exception $e) {
$this->em->getConnection()->rollback();
$this->em->close();
throw $e;
}
}
示例5: addService
public function addService(Service $service)
{
$this->services[$service->getId()] = $service;
}