当前位置: 首页>>代码示例>>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;未经允许,请勿转载。