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


PHP unknown::getTable方法代碼示例

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


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

示例1: __construct

 /**
  *
  * @param unknown $column            
  * @param unknown $referenceTable            
  * @param unknown $referenceColumn            
  * @param unknown $update            
  * @param unknown $delete            
  */
 public function __construct($column, $referenceTable, $referenceColumn, $update, $delete)
 {
     // r = raiz
     // d = destino
     $nameReferenceTable = $referenceTable;
     if ($referenceTable instanceof TableIdentifier) {
         $nameReferenceTable = $referenceTable->getTable();
         $referenceTable = "{$referenceTable->getSchema()}.{$referenceTable->getTable()}";
     }
     $name = "{$nameReferenceTable}_r{$column}_d{$referenceColumn}_fkey";
     $this->setOnUpdateRule(strtoupper($update));
     $this->setOnDeleteRule(strtoupper($delete));
     parent::__construct($name, $column, $referenceTable, $referenceColumn);
 }
開發者ID:bhcosta90,項目名稱:zend,代碼行數:22,代碼來源:ForeignKey.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: byTag

 /**
  * Query scope for filtering data by category Ids
  * @param unknown $model
  * @param string $values
  */
 public function byTag($model, $values = '')
 {
     if (!$values) {
         $values = $this->getValue();
     }
     $table = $model instanceof Model ? $model->getTable() : $model->getModel()->getTable();
     return $model->join('product_to_tag', function ($join) use($table, $values) {
         $join->on($table . '.id', '=', 'product_to_tag.product_pk_id');
         $join->whereIn('product_to_tag.product_tag_pk_id', $values);
     });
 }
開發者ID:atudz,項目名稱:snapneat,代碼行數:16,代碼來源:SelectFilter.php


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