當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Resource::getId方法代碼示例

本文整理匯總了PHP中Resource::getId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Resource::getId方法的具體用法?PHP Resource::getId怎麽用?PHP Resource::getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Resource的用法示例。


在下文中一共展示了Resource::getId方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: pullId

 /**
  * Attempts to extract the required id from a resource, throwing an exception if id
  * is null.
  * @param \Resource $resource
  * @return integer
  * @throws \Exception
  */
 private static function pullId(\Resource $resource)
 {
     $id = $resource->getId();
     if (empty($id)) {
         throw new \Exception(t('Id not set in Resource "%s"', get_class($resource)));
     }
     return $id;
 }
開發者ID:sysulsj,項目名稱:phpwebsite,代碼行數:15,代碼來源:ResourceFactory.php

示例2: serializeResource

 public function serializeResource(Resource $resource)
 {
     $data['id'] = $resource->getId();
     $data['_type'] = $resource->getType()->getName();
     $data['href'] = $this->primate->getBaseUrl() . '/' . $resource->getType()->getName() . '/' . $resource->getId();
     foreach ($resource->getProperties() as $name => $value) {
         switch (gettype($value)) {
             case 'array':
                 $data[$name] = '[]';
                 break;
             case 'object':
                 if (is_subclass_of($value, '\\Primate\\ResourceInterface')) {
                     $data[$name] = $this->serializeResource($value);
                 } else {
                     $data[$name] = '???';
                 }
                 break;
             default:
                 $data[$name] = $value;
                 break;
         }
     }
     return $data;
 }
開發者ID:linkorb,項目名稱:primate,代碼行數:24,代碼來源:Serializer.php

示例3: stampResource

 /**
  * Stamps the current datestamp and ip_address.
  */
 public static function stampResource(\Resource $resource, $action)
 {
     $activity = new Activity();
     $activity->class_name = $resource->getNamespace();
     $activity->resource_id = $resource->getId();
     $activity->action = $action;
     if (\User\Current::isLoggedIn()) {
         $activity->user_id = \User\Current::getUserId();
     }
     try {
         $activity->ip_address = \Server::getUserIp();
     } catch (Exception $e) {
         $activity->ip_address = '0.0.0.0';
         \Error::log($e);
     }
     \ResourceFactory::saveResource($activity);
 }
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:20,代碼來源:Activity.php

示例4: getId

 public function getId()
 {
     return parent::getId();
 }
開發者ID:hborras,項目名稱:twitter-php-ads-sdk,代碼行數:4,代碼來源:Analytics.php

示例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      Resource $value A Resource object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Resource $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
開發者ID:raulito1500,項目名稱:mdokeos,代碼行數:22,代碼來源:BaseResourcePeer.php

示例6: prune

 /**
  * Exclude object from result
  *
  * @param     Resource $resource Object to remove from the list of results
  *
  * @return    ResourceQuery The current query, for fluid interface
  */
 public function prune($resource = null)
 {
     if ($resource) {
         $this->addUsingAlias(ResourcePeer::ID, $resource->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
開發者ID:raulito1500,項目名稱:mdokeos,代碼行數:14,代碼來源:BaseResourceQuery.php

示例7: ProductionMod

    $productionMod = new ProductionMod($productionModArr[0], $productionModArr[1], $productionModArr[2], $productionModArr[3], $productionModArr[4], $productionModArr[5], $productionModArr[6]);
    $productionMods[$productionMod->getId()] = $productionMod;
    if ($productionMod->getTargetClassId() == 'Building') {
        $productionModLinks[$productionMod->getTargetId()][] = $productionMod;
    }
}
$buildingsArr = $buildingConn->getAllBuildings();
foreach ($buildingsArr as $buildingArr) {
    $buildingName = $terms[$buildingArr[1]]->getString();
    $buildingDescription = $terms[$buildingArr[13]]->getString();
    $building = new Building($buildingArr[0], $buildingName, $buildingArr[2], $buildingArr[3], $buildingArr[4], $buildingArr[5], $buildingArr[6], explode(",", $buildingArr[7]), explode(",", $buildingArr[8]), explode(",", $buildingArr[9]), explode(",", $buildingArr[10]), $buildingArr[11], $buildingArr[12], $buildingDescription, $buildingArr[14], $buildingArr[15]);
    if (isset($productionModLinks[$building->getId()])) {
        $building->setProductionMods($productionModLinks[$building->getId()]);
    }
    $buildings[$building->getId()] = $building;
}
$staticData->setBuildings($buildings);
$playersArr = $playerConn->getAllPlayers();
foreach ($playersArr as $playerArr) {
    $player = new Player($playerArr[0], $playerArr[1], $playerArr[2], $playerArr[3], $playerArr[4], $playerArr[5], $playerArr[6], $playerArr[7], explode(",", $playerArr[8]), $playerArr[9], $playerArr[10]);
    $players[$player->getId()] = $player;
}
$staticData->setPlayers($players);
$resourcesArr = $resourceConn->getAllResources();
foreach ($resourcesArr as $resourceArr) {
    $resourceName = $terms[$resourceArr[1]]->getString();
    $resource = new Resource($resourceArr[0], $resourceName, $resourceArr[2], $resourceArr[3], $resourceArr[4], $resourceArr[5]);
    $resources[$resource->getId()] = $resource;
}
$staticData->setResources($resources);
$_SESSION['staticData'] = $staticData;
開發者ID:LordMatrix,項目名稱:Ochorri,代碼行數:31,代碼來源:initStaticData.php


注:本文中的Resource::getId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。