本文整理汇总了PHP中Column::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::getName方法的具体用法?PHP Column::getName怎么用?PHP Column::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Column
的用法示例。
在下文中一共展示了Column::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeSubColumn
public function removeSubColumn(Column $column)
{
$this->subColumns = array_values(array_filter($this->subColumns, function ($elm) use($column) {
return $elm->getName() !== $column->getName();
}));
return $this;
}
示例2: addMutatorClose
/**
* Adds the close of mutator (setter) method for a column.
* This method overrides the method from PHP5BasicObjectBuilder in order to
* account for updating related objects.
* @param string &$script The script will be modified in this method.
* @param Column $col The current column.
* @see PHP5BasicObjectBuilder::addMutatorClose()
*/
protected function addMutatorClose(&$script, Column $col)
{
$table = $this->getTable();
$cfc = $col->getPhpName();
$clo = strtolower($col->getName());
if ($col->isForeignKey()) {
$tblFK = $table->getDatabase()->getTable($col->getRelatedTableName());
$colFK = $tblFK->getColumn($col->getRelatedColumnName());
$varName = $this->getFKVarName($col->getForeignKey());
$script .= "\n\t\tif (\$this->{$varName} !== null && \$this->" . $varName . "->get" . $colFK->getPhpName() . "() !== \$v) {\n\t\t\t\$this->{$varName} = null;\n\t\t}\n";
}
/* if col is foreign key */
foreach ($col->getReferrers() as $fk) {
$tblFK = $this->getDatabase()->getTable($fk->getForeignTableName());
if ($tblFK->getName() != $table->getName()) {
$collName = $this->getRefFKCollVarName($fk);
$tblFK = $table->getDatabase()->getTable($col->getRelatedTableName());
$colFK = $tblFK->getColumn($col->getRelatedColumnName());
$script .= "\n\n\t\t// update associated " . $tblFK->getPhpName() . "\n\t\tif (\$this->{$collName} !== null) {\n\t\t\tforeach(\$this->{$collName} as \$referrerObject) {\n\t\t\t\t \$referrerObject->set" . $colFK->getPhpName() . "(\$v);\n\t\t\t }\n\t\t }\n";
}
// if
}
// foreach
$script .= "\n\t} // set{$cfc}()\n";
}
示例3: getColumnDDL
/**
* Builds the DDL SQL for a Column object.
* @return string
*/
public function getColumnDDL(Column $col)
{
$platform = $this->getPlatform();
$domain = $col->getDomain();
$sb = "";
$sb .= $this->quoteIdentifier($col->getName()) . " ";
$sb .= $domain->getSqlType();
if ($platform->hasSize($domain->getSqlType())) {
$sb .= $domain->printSize();
}
$sb .= " ";
$sb .= $col->getDefaultSetting() . " ";
$sb .= $col->getNotNullString() . " ";
$sb .= $col->getAutoIncrementString();
return trim($sb);
}
示例4: addLazyLoaderBody
/**
* Adds the function body for the lazy loader method
* @param string &$script The script will be modified in this method.
* @param Column $col The current column.
* @see addLazyLoader()
**/
protected function addLazyLoaderBody(&$script, Column $col)
{
$platform = $this->getPlatform();
$clo = strtolower($col->getName());
$script .= "\n\t\t\$c = \$this->buildPkeyCriteria();\n\t\t\$c->addSelectColumn(" . $this->getColumnConstant($col) . ");\n\t\ttry {\n\t\t\t\$stmt = " . $this->getPeerClassname() . "::doSelectStmt(\$c, \$con);\n\t\t\t\$row = \$stmt->fetch(PDO::FETCH_NUM);\n\t\t\t\$stmt->closeCursor();";
if ($col->getType() === PropelTypes::CLOB && $this->getPlatform() instanceof OraclePlatform) {
// PDO_OCI returns a stream for CLOB objects, while other PDO adapters return a string...
$script .= "\n\t\t\t\$this->{$clo} = stream_get_contents(\$row[0]);";
} elseif ($col->isLobType() && !$platform->hasStreamBlobImpl()) {
$script .= "\n\t\t\tif (\$row[0] !== null) {\n\t\t\t\t\$this->{$clo} = fopen('php://memory', 'r+');\n\t\t\t\tfwrite(\$this->{$clo}, \$row[0]);\n\t\t\t\trewind(\$this->{$clo});\n\t\t\t} else {\n\t\t\t\t\$this->{$clo} = null;\n\t\t\t}";
} elseif ($col->isPhpPrimitiveType()) {
$script .= "\n\t\t\t\$this->{$clo} = (\$row[0] !== null) ? (" . $col->getPhpType() . ") \$row[0] : null;";
} elseif ($col->isPhpObjectType()) {
$script .= "\n\t\t\t\$this->{$clo} = (\$row[0] !== null) ? new " . $col->getPhpType() . "(\$row[0]) : null;";
} else {
$script .= "\n\t\t\t\$this->{$clo} = \$row[0];";
}
$script .= "\n\t\t\t\$this->" . $clo . "_isLoaded = true;\n\t\t} catch (Exception \$e) {\n\t\t\tthrow new PropelException(\"Error loading value for [{$clo}] column on demand.\", \$e);\n\t\t}";
}
示例5: __construct
/**
* Constructs an instance from a list of column headers as returned by the
* Google Analytics API.
*
* @param array $headers
* @param Google\Analytics\API $api
*/
public function __construct(array $headers, API $api)
{
$headerCount = count($headers);
for ($i = 0; $i < $headerCount; $i++) {
self::_validateHeader($headers[$i]);
try {
$column = $api->getColumn($headers[$i]['name']);
} catch (InvalidArgumentException $e) {
/* I don't expect this to happen but in case it does, we can
create a representation of the column by building it on the
fly, though it will be missing most of the available
properties. */
$column = new Column();
$column->setID(API::addPrefix($headers[$i]['name']));
$column->setType($headers[$i]['columnType']);
$column->setDataType($headers[$i]['dataType']);
}
$this->_columns[] = $column;
$this->_columnIndicesByName[$column->getName()] = $i;
}
}
示例6: getColumnBaseIdentifier
/**
* Get the quoted identifier for the column name
* @param Column $column
* @return string
*/
public function getColumnBaseIdentifier(Column $column)
{
return $this->quoteObjectIdentifier($column->getName());
}
示例7: addColumn
public function addColumn(Column $col)
{
$this->columns[$col->getName()] = $col;
return $this;
}
示例8: getColumnDDL
public function getColumnDDL(Column $col)
{
$domain = $col->getDomain();
$ddl = array($this->quoteIdentifier($col->getName()));
$sqlType = $domain->getSqlType();
$table = $col->getTable();
if ($col->isAutoIncrement() && $table && $table->getIdMethodParameters() == null) {
$sqlType = $col->getType() === PropelTypes::BIGINT ? 'bigserial' : 'serial';
}
if ($this->hasSize($sqlType) && $col->isDefaultSqlType($this)) {
$ddl[] = $sqlType . $domain->printSize();
} else {
$ddl[] = $sqlType;
}
if ($default = $this->getColumnDefaultValueDDL($col)) {
$ddl[] = $default;
}
if ($notNull = $this->getNullString($col->isNotNull())) {
$ddl[] = $notNull;
}
if ($autoIncrement = $col->getAutoIncrementString()) {
$ddl[] = $autoIncrement;
}
return implode(' ', $ddl);
}
示例9: getColumnName
/**
* Gets the name of the column that this Validator applies to.
* @return string
*/
public function getColumnName()
{
return $this->column->getName();
}
示例10: isForeignKey
/**
* Metodo que verifica se a coluna eh foreign key, caso for - retorna os dados da chave estrangeira
*
* @param Column $objColumn
* @return array
*/
private function isForeignKey($objColumn)
{
$arrForeignKey = [];
if (array_key_exists($objColumn->getName(), $this->arrForeignKeys)) {
$arrForeignKey = $this->arrForeignKeys[$objColumn->getName()];
}
return $arrForeignKey;
}
示例11: _refreshColumnMetadata
/**
* Populates the properties that store cached dimensions and metrics,
* either from the database or from the API directly, depending on when
* the data that we have was last fetched.
*/
private function _refreshColumnMetadata()
{
/* If we're not using a database, the best we can do is to cache the
column metadata for the duration of this process' existence. */
if (self::$_dbConn) {
try {
$lastFetchData = self::_getLastFetchData('google_analytics_api_columns');
if ($lastFetchData) {
$fetchDate = (int) $lastFetchData['fetch_date'];
$etag = $lastFetchData['etag'];
} else {
$fetchDate = null;
$etag = null;
}
$columns = null;
$newETag = null;
if ($this->_bypassColumnCache || !$fetchDate || $fetchDate <= time() - GOOGLE_ANALYTICS_API_METADATA_CACHE_DURATION) {
$this->_bypassColumnCache = false;
$request = new APIRequest('metadata/ga/columns');
if ($etag) {
$request->setHeader('If-None-Match: ' . $etag);
}
$columns = $this->_makeRequest($request);
if ($columns) {
$stmt = self::$_DB_STATEMENTS['google_analytics_api_columns']['insert'];
foreach ($columns as $column) {
$stmt->bindValue(':name', $column->getName(), \PDO::PARAM_STR);
$stmt->bindValue(':type', $column->getType(), \PDO::PARAM_STR);
$stmt->bindValue(':data_type', $column->getDataType(), \PDO::PARAM_STR);
$stmt->bindValue(':replaced_by', $column->getReplacementColumn(), \PDO::PARAM_STR);
$stmt->bindValue(':group', $column->getGroup(), \PDO::PARAM_STR);
$stmt->bindValue(':ui_name', $column->getUIName(), \PDO::PARAM_STR);
$stmt->bindValue(':description', $column->getDescription(), \PDO::PARAM_STR);
$stmt->bindValue(':calculation', $column->getCalculation(), \PDO::PARAM_STR);
$stmt->bindValue(':min_template_index', $column->getMinTemplateIndex(), \PDO::PARAM_INT);
$stmt->bindValue(':max_template_index', $column->getMaxTemplateIndex(), \PDO::PARAM_INT);
$stmt->bindValue(':min_template_index_premium', $column->getPremiumMinTemplateIndex(), \PDO::PARAM_INT);
$stmt->bindValue(':max_template_index_premium', $column->getPremiumMaxTemplateIndex(), \PDO::PARAM_INT);
$stmt->bindValue(':allowed_in_segments', $column->isAllowedInSegments(), \PDO::PARAM_INT);
$stmt->bindValue(':deprecated', $column->isDeprecated(), \PDO::PARAM_INT);
$stmt->execute();
}
$stmt = null;
}
if (array_key_exists('etag', $this->_responseParsed) && $this->_responseParsed['etag']) {
$newETag = $this->_responseParsed['etag'];
} else {
$responseHeader = $this->getResponseHeaderAsAssociativeArray();
if (array_key_exists('ETag', $responseHeader) && $responseHeader['ETag']) {
$newETag = $responseHeader['ETag'];
}
}
if ($newETag) {
self::_storeFetchData('google_analytics_api_columns', count($columns), $newETag);
}
}
if (!$columns) {
$columns = array();
$stmt = self::$_dbConn->query('SELECT * FROM google_analytics_api_columns');
$stmt->bindColumn('name', $name, \PDO::PARAM_STR);
$stmt->bindColumn('type', $type, \PDO::PARAM_STR);
$stmt->bindColumn('data_type', $dataType, \PDO::PARAM_STR);
$stmt->bindColumn('replaced_by', $replacement, \PDO::PARAM_STR);
$stmt->bindColumn('group', $group, \PDO::PARAM_STR);
$stmt->bindColumn('ui_name', $uiName, \PDO::PARAM_STR);
$stmt->bindColumn('description', $description, \PDO::PARAM_STR);
$stmt->bindColumn('calculation', $calculation, \PDO::PARAM_STR);
/* Null values get cast to zeros if I bind them as
integers, so we'll rely on the object's setter to take care
of the type casting. */
$stmt->bindColumn('min_template_index', $minTemplateIndex, \PDO::PARAM_STR);
$stmt->bindColumn('max_template_index', $maxTemplateIndex, \PDO::PARAM_STR);
$stmt->bindColumn('min_template_index_premium', $minTemplateIndexPremium, \PDO::PARAM_STR);
$stmt->bindColumn('max_template_index_premium', $maxTemplateIndexPremium, \PDO::PARAM_STR);
$stmt->bindColumn('allowed_in_segments', $allowedInSegments, \PDO::PARAM_BOOL);
$stmt->bindColumn('deprecated', $deprecated, \PDO::PARAM_BOOL);
while ($stmt->fetch(\PDO::FETCH_BOUND)) {
$column = new Column();
$column->setID('ga:' . $name);
$column->setReplacementColumn($replacement);
$column->setType($type);
$column->setDataType($dataType);
$column->setGroup($group);
$column->setUIName($uiName);
$column->setDescription($description);
$column->setCalculation($calculation);
if ($minTemplateIndex !== null) {
$column->setMinTemplateIndex($minTemplateIndex);
}
if ($maxTemplateIndex !== null) {
$column->setMaxTemplateIndex($maxTemplateIndex);
}
if ($minTemplateIndexPremium !== null) {
$column->setPremiumMinTemplateIndex($minTemplateIndexPremium);
}
//.........这里部分代码省略.........
示例12: getRemoveColumnDDL
/**
* Builds the DDL SQL to remove a column
*
* @return string
*/
public function getRemoveColumnDDL(Column $column)
{
$pattern = "\nALTER TABLE %s DROP %s;\n";
return sprintf($pattern, $this->quoteIdentifier($column->getTable()->getName()), $this->quoteIdentifier($column->getName()));
}
示例13: addTemporalMutator
/**
* Adds a setter method for date/time/timestamp columns.
* @param string &$script The script will be modified in this method.
* @param Column $col The current column.
* @see parent::addColumnMutators()
*/
protected function addTemporalMutator(&$script, Column $col)
{
$cfc = $col->getPhpName();
$clo = strtolower($col->getName());
$visibility = $col->getMutatorVisibility();
$dateTimeClass = $this->getBuildProperty('dateTimeClass');
if (!$dateTimeClass) {
$dateTimeClass = 'DateTime';
}
$script .= "\n\t/**\n\t * Sets the value of [{$clo}] column to a normalized version of the date/time value specified.\n\t * " . $col->getDescription() . "\n\t * @param mixed \$v string, integer (timestamp), or DateTime value. Empty string will\n\t *\t\t\t\t\t\tbe treated as NULL for temporal objects.\n\t * @return " . $this->getObjectClassname() . " The current object (for fluent API support)\n\t */\n\t" . $visibility . " function set{$cfc}(\$v)\n\t{";
$this->addMutatorOpenBody($script, $col);
$fmt = var_export($this->getTemporalFormatter($col), true);
$script .= "\n\t\t// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')\n\t\t// -- which is unexpected, to say the least.\n\t\tif (\$v === null || \$v === '') {\n\t\t\t\$dt = null;\n\t\t} elseif (\$v instanceof DateTime) {\n\t\t\t\$dt = \$v;\n\t\t} else {\n\t\t\t// some string/numeric value passed; we normalize that so that we can\n\t\t\t// validate it.\n\t\t\ttry {\n\t\t\t\tif (is_numeric(\$v)) { // if it's a unix timestamp\n\t\t\t\t\t\$dt = new {$dateTimeClass}('@'.\$v, new DateTimeZone('UTC'));\n\t\t\t\t\t// We have to explicitly specify and then change the time zone because of a\n\t\t\t\t\t// DateTime bug: http://bugs.php.net/bug.php?id=43003\n\t\t\t\t\t\$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));\n\t\t\t\t} else {\n\t\t\t\t\t\$dt = new {$dateTimeClass}(\$v);\n\t\t\t\t}\n\t\t\t} catch (Exception \$x) {\n\t\t\t\tthrow new PropelException('Error parsing date/time value: ' . var_export(\$v, true), \$x);\n\t\t\t}\n\t\t}\n\n\t\tif ( \$this->{$clo} !== null || \$dt !== null ) {\n\t\t\t// (nested ifs are a little easier to read in this case)\n\n\t\t\t\$currNorm = (\$this->{$clo} !== null && \$tmpDt = new {$dateTimeClass}(\$this->{$clo})) ? \$tmpDt->format({$fmt}) : null;\n\t\t\t\$newNorm = (\$dt !== null) ? \$dt->format({$fmt}) : null;\n\n\t\t\tif ( (\$currNorm !== \$newNorm) // normalized values don't match ";
if (($def = $col->getDefaultValue()) !== null && !$def->isExpression()) {
$defaultValue = $this->getDefaultValueString($col);
$script .= "\n\t\t\t\t\t|| (\$dt->format({$fmt}) === {$defaultValue}) // or the entered value matches the default";
}
$script .= "\n\t\t\t\t\t)\n\t\t\t{\n\t\t\t\t\$this->{$clo} = (\$dt ? \$dt->format({$fmt}) : null);\n\t\t\t\t\$this->modifiedColumns[] = " . $this->getColumnConstant($col) . ";\n\t\t\t}\n\t\t} // if either are not null\n";
$this->addMutatorClose($script, $col);
}
示例14: getObject
public function getObject(Column $column)
{
switch ($column->getType()) {
case self::DBFFIELD_TYPE_CHAR:
return $this->getString($column->getName());
case self::DBFFIELD_TYPE_DOUBLE:
return $this->getDouble($column->getName());
case self::DBFFIELD_TYPE_DATE:
return $this->getDate($column->getName());
case self::DBFFIELD_TYPE_DATETIME:
return $this->getDateTime($column->getName());
case self::DBFFIELD_TYPE_FLOATING:
return $this->getFloat($column->getName());
case self::DBFFIELD_TYPE_LOGICAL:
return $this->getBoolean($column->getName());
case self::DBFFIELD_TYPE_MEMO:
return $this->getMemo($column->getName());
case self::DBFFIELD_TYPE_NUMERIC:
return $this->getNum($column->getName());
case self::DBFFIELD_TYPE_INDEX:
return $this->getIndex($column->getName(), $column->getLength());
case self::DBFFIELD_IGNORE_0:
return false;
}
throw new Exception\InvalidColumnException(sprintf('Cannot handle datatype %s', $column->getType()));
}
示例15: addColumn
/**
* Adds a column to the definition of the Model.
*
* @param Column $column the column to add.
*/
function addColumn(Column $column)
{
$this->columns[$column->getName()] = $column;
}