当前位置: 首页>>代码示例>>PHP>>正文


PHP EntityManager::get方法代码示例

本文整理汇总了PHP中EntityManager::get方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityManager::get方法的具体用法?PHP EntityManager::get怎么用?PHP EntityManager::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EntityManager的用法示例。


在下文中一共展示了EntityManager::get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saniziteByDataType

 /**
  * Sanea por el tipo de dato en el modelo
  *
  * @param	string $modelName
  * @param	string $fieldName
  * @param	mixed $value
  */
 public static function saniziteByDataType($modelName, $fieldName, $value)
 {
     $entity = EntityManager::get($modelName);
     if ($entity->hasField($fieldName)) {
         if (get_magic_quotes_gpc() == false) {
             $value = addslashes($value);
         }
         $dataTypes = $entity->getDataTypes();
         $dataType = $dataTypes[$fieldName];
         if ($value === '' || $value === null) {
             return null;
         } else {
             if (strpos($dataType, 'decimal')) {
                 return Filter::bring($value, 'double');
             } else {
                 if (strpos($dataType, 'int')) {
                     return Filter::bring($value, 'int');
                 } else {
                     return Filter::bring($value, 'striptags');
                 }
             }
         }
     } else {
         throw new ActiveRecordException('El campo "' . $fieldName . '" no hace parte de la entidad "' . $modelName . '"');
     }
 }
开发者ID:noikiy,项目名称:kumbia-zephir,代码行数:33,代码来源:ActiveRecordUtils.php

示例2: getService

 /**
  * Este metodo e usado para fazer uma chamada de servico e retornar uma instancia do mesmo
  * @param string $modulo
  * @param string $servico
  * @param integer $modalidade
  * @return Uma instancia do objeto do servico requisitado
  */
 public function getService($modulo, $servico, $type_service = self::TYPE_SERVICE, $modalidade = self::ZEND_FRAMEWORK)
 {
     $this->modalidade = $modalidade;
     $this->modulo = $modulo;
     $this->servico = $servico;
     $this->type_service = $type_service;
     $this->service_namespace = str_replace('/', '\\', $this->obtemNamespace());
     if (!class_exists($this->service_namespace)) {
         throw new \Exception("Erro ao carregar a classe {$this->service_namespace}, verique se a classe existe ou se os parametros foram passados corretamente!");
     }
     $instancia = null;
     if ($this->modalidade == self::ZEND_FRAMEWORK) {
         if ($this->type_service = self::TYPE_ENTITY) {
             $this->configuraZeDb();
             $instancia = $this->em->get($this->service_namespace);
         } else {
             $instancia = new $this->service_namespace();
         }
     }
     return $instancia;
 }
开发者ID:jbmchd,项目名称:semente.lanches,代码行数:28,代码来源:ServiceManager.php

示例3: getCaller

function getCaller($sid)
{
    return EntityManager::get()->getRepository('Realms\\Player')->findOneBy(array('sessionId' => $sid));
}
开发者ID:harmjanhaisma,项目名称:PocketMine-Realms,代码行数:4,代码来源:Utils.php

示例4: function

// The server sends this to the API. A plugin must be written to handle this portion
$requestHandler->respond('POST', '/server/heartbeat', function ($request, $response) {
    if (!isset($request->nplayers)) {
        $response->code(400);
        $response->body('Bad request');
        $response->send();
        return;
    }
    $key = $request->cookies()->get('key');
    if ($key === null) {
        $response->code(401);
        $response->body('key is required');
        $response->send();
        return;
    }
    $server = EntityManager::get()->getRepository('Realms\\Server')->findOneBy(array('key' => $key));
    if ($server === null) {
        $response->code(401);
        $response->body('Invalid key');
        $response->send();
        return;
    }
    // We aren't entirely sure what nplayers entails.
    // We know that this should be the server announcing that it is alive
    // and it may be viable to add a flag to the server model to show/hide
    // the server accordingly in /server/list
});
// The server sends this as well. We have no example of what the two parameters are.
$requestHandler->respond('GET', '/auth/validate-player/[a:a]/[a:b]', function ($request, $response) {
    //this probably checks the whitelist but what are the parameters?
    $key = $request->cookies()->get('key');
开发者ID:harmjanhaisma,项目名称:PocketMine-Realms,代码行数:31,代码来源:index.php


注:本文中的EntityManager::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。