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


PHP unknown::exists方法代码示例

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


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

示例1: exists

 /**
  * 
  * 
  * @param $data
  * @return unknown
  */
 function exists($data)
 {
     $data['type'] = $data['type'] ? $data['type'] : '';
     $data['cat_id'] = $data['cat_id'] ? $data['cat_id'] : '';
     return $this->cats->exists($data['type'], $data['cat_name'], $data['cat_id']);
 }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:12,代码来源:class.bocategories.inc.php

示例2: air2_model_prevalidate

/**
 *
 *
 * @param unknown $model
 */
function air2_model_prevalidate(&$model)
{
    $table = $model->getTable();
    $col_defs = $table->getColumns();
    $now = air2_date();
    foreach ($col_defs as $col => $def) {
        if (preg_match('/_uuid$/', $col) && isset($def['unique']) && $def['unique']) {
            if (!isset($model->{$col}) || !strlen($model->{$col})) {
                $model->{$col} = air2_generate_uuid(12);
            }
        } elseif (preg_match('/_cre_dtim$/', $col)) {
            if (!$model->exists() && !strlen($model->{$col})) {
                $model->{$col} = $now;
            }
        } elseif (preg_match('/_upd_dtim$/', $col)) {
            $model->{$col} = $now;
        } elseif (preg_match('/_cre_user$/', $col)) {
            if (!$model->exists() && !strlen($model->{$col})) {
                if (defined('AIR2_REMOTE_USER_ID')) {
                    $model->{$col} = AIR2_REMOTE_USER_ID;
                } else {
                    $model->{$col} = 1;
                    //sysuser -- TODO: check for shell users
                }
            }
        } elseif (preg_match('/_upd_user$/', $col)) {
            if (defined('AIR2_REMOTE_USER_ID')) {
                $model->{$col} = AIR2_REMOTE_USER_ID;
            } else {
                $model->{$col} = 1;
                //sysuser -- TODO: check for shell users
            }
        } elseif ($def['type'] === 'timestamp') {
            // validate the string for non cre/upd timestamps
            if (isset($model->{$col}) && !is_null($model->{$col})) {
                //NOTE: whenever you set a column in Doctrine, it checks that
                //the value has changed.  Since '2010-01-01 01:01:01' is equal
                //to '2010-01-01T01:01:01', we need to NULL it first
                if (strpos($model->{$col}, 'T') !== false) {
                    $airformat = air2_date(strtotime($model->{$col}));
                    $model->{$col} = null;
                    $model->{$col} = $airformat;
                }
            }
        } elseif ($def['type'] === 'date') {
            // validate the string for non cre/upd timestamps
            if (isset($model->{$col}) && !is_null($model->{$col})) {
                //NOTE: whenever you set a column in Doctrine, it checks that
                //the value has changed.  Since '2010-01-01 01:01:01' is equal
                //to '2010-01-01T01:01:01', we need to NULL it first
                if (strpos($model->{$col}, 'T') !== false) {
                    $airformat = air2_date(strtotime($model->{$col}));
                    $model->{$col} = null;
                    $model->{$col} = $airformat;
                }
            }
        }
        // default values
        if (strlen($table->getDefaultValueOf($col)) && !strlen($model->{$col})) {
            $model->{$col} = $table->getDefaultValueOf($col);
        }
        // lastly, check strings for valid UTF8 chars
        if ($def['type'] === 'string' && !Encoding::is_utf8($model->{$col})) {
            $modelname = get_class($model);
            throw new Doctrine_Exception("non-UTF8 string found in {$modelname}->{$col}: " . $model->{$col});
        }
    }
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:73,代码来源:AIR2_Utils.php

示例3: existsMain

 /**
  * 检查给定的Key是否存在
  * @param string $key
  */
 public function existsMain($key = '')
 {
     return $this->cacheWrite->exists($key);
 }
开发者ID:noikiy,项目名称:public,代码行数:8,代码来源:BalanceRedisBase.php


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