本文整理汇总了PHP中Site::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::getId方法的具体用法?PHP Site::getId怎么用?PHP Site::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::getId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSiteKey
public static function getSiteKey(Site $site = null)
{
if ($site) {
$siteKey = "site_" . $site->getId();
} else {
$siteKey = "default";
}
return $siteKey;
}
示例2: setSite
/**
* Declares an association between this object and a Site object.
*
* @param Site $v
* @return Sitefeed The current object (for fluent API support)
* @throws PropelException
*/
public function setSite(Site $v = null)
{
if ($v === null) {
$this->setSiteId(NULL);
} else {
$this->setSiteId($v->getId());
}
$this->aSite = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Site object, it will not be re-added.
if ($v !== null) {
$v->addSitefeed($this);
}
return $this;
}
示例3: copySite
public function copySite(Site $s, $new_name, $seconds = 10)
{
if (!is_numeric($seconds) || !$seconds > 0) {
throw new e\UnacceptableValueException(S_SPAN . c\M::UNACCEPTABLE_SECONDS . E_SPAN);
}
$this->service->siteCopy($s->getId(), $s->getName(), $new_name);
// wait until it is done
sleep($seconds);
if ($this->service->isSuccessful()) {
return $this;
}
throw new e\SiteCreationFailureException(S_SPAN . c\M::SITE_CREATION_FAILURE . E_SPAN . $this->service->getMessage());
}
示例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: addInstanceToPool
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Site $value A Site object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Site $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}
示例6: strpos
foreach($siteUrls as $url)
{
$posInUrl = strpos($pageUrl, $url);
$trouve = ($posInUrl == 0);
}
if (! $trouve) {
printDebug("Url is not ok !");
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
exit();
}
*/
/**
* exit if visitor is cookie excluded from the stats
*/
if (isset($_COOKIE[COOKIE_NAME_NO_STAT . $site->getId()])) {
printDebug("Excluded from stats with the cookie!");
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
}
/*
* page variables
*/
$a_vars = getRequestVar('a_vars', array(), 'array');
/*
* visitor config, as saved in the database
*/
$userAgent = secureVar(@$_SERVER['HTTP_USER_AGENT']);
$os = getOs($userAgent);
$a_browser = getBrowserInfo($userAgent);
$resolution = getRequestVar('res', 'unknown', 'string');
示例7: setDefaultSite
public function setDefaultSite(Site $site = NULL)
{
if (isset($site)) {
$this->getProperty()->defaultSiteId = $site->getId();
$this->getProperty()->defaultSiteName = $site->getName();
} else {
$this->getProperty()->defaultSiteId = NULL;
$this->getProperty()->defaultSiteName = NULL;
}
return $this;
}
示例8: moveSite
public function moveSite(\Site $Site, \NGI $NGI, \User $user = null)
{
//Check the portal is not in read only mode, throws exception if it is
$this->checkPortalIsNotReadOnlyOrUserIsAdmin($user);
//Throws exception if user is not an administrator
$this->checkUserIsAdmin($user);
$this->em->getConnection()->beginTransaction();
// suspend auto-commit
try {
//If the NGI or site have no ID - throw logic exception
$site_id = $Site->getId();
if (empty($site_id)) {
throw new LogicException('Site has no ID');
}
$ngi_id = $NGI->getId();
if (empty($ngi_id)) {
throw new LogicException('NGI has no ID');
}
//find old NGI
$old_NGI = $Site->getNgi();
//If the NGI has changed, then we move the site.
if ($old_NGI != $NGI) {
//Remove the site from the old NGI FIRST if it has an old NGI
if (!empty($old_NGI)) {
$old_NGI->getSites()->removeElement($Site);
}
//Add site to new NGI
$NGI->addSiteDoJoin($Site);
//$Site->setNgiDoJoin($NGI);
//persist
$this->em->merge($NGI);
$this->em->merge($old_NGI);
}
//close if
$this->em->flush();
$this->em->getConnection()->commit();
} catch (\Exception $e) {
$this->em->getConnection()->rollback();
$this->em->close();
throw $e;
}
}