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


PHP ColumnMap类代码示例

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


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

示例1: getPrimaryKeys

 public function getPrimaryKeys()
 {
     $cm = new \ColumnMap('id', new \TableMap());
     $cm->setType('INTEGER');
     $cm->setPhpName('Id');
     return array('id' => $cm);
 }
开发者ID:gr-thao,项目名称:jobeet,代码行数:7,代码来源:ItemQuery.php

示例2: addCIRValidation

 public static function addCIRValidation(TableMap $map, ColumnMap $column, $message = null)
 {
     $columnName = $column->getColumnName();
     $value = $column->getRelatedTableName();
     if (!isset($message)) {
         $message = $value . " non trouvé";
     }
     $map->addValidator($columnName, "class", "utils.CIRValidator", $value, $message);
 }
开发者ID:sandrineBeauche,项目名称:cookbookServer,代码行数:9,代码来源:CIRPeerUtils.php

示例3: bindValue

 /**
  * @see        DBAdapter::bindValue()
  */
 public function bindValue(PDOStatement $stmt, $parameter, $value, ColumnMap $cMap)
 {
     if ($cMap->isTemporal()) {
         $value = $this->formatTemporalValue($value, $cMap);
     } elseif (is_resource($value) && $cMap->isLob()) {
         // we always need to make sure that the stream is rewound, otherwise nothing will
         // get written to database.
         rewind($value);
         // pdo_sqlsrv must have bind binaries using bindParam so that the PDO::SQLSRV_ENCODING_BINARY
         // driver option can be utilized. This requires a unique blob parameter because the bindParam
         // value is passed by reference and if we didn't do this then the referenced parameter value
         // would change on the next loop
         $blob = "blob" . $position;
         ${$blob} = $value;
         return $stmt->bindParam($parameter, ${$blob}, PDO::PARAM_LOB, 0, PDO::SQLSRV_ENCODING_BINARY);
     }
     return $stmt->bindValue($parameter, $value, $cMap->getPdoType());
 }
开发者ID:rubensayshi,项目名称:propelsandbox,代码行数:21,代码来源:DBSQLSRV.php

示例4: __construct

 /**
  * Create a new instance.
  *
  * @param      Criteria $parent The outer class (this is an "inner" class).
  * @param      ColumnMap $column A Column object to help escaping the value
  * @param      mixed $value
  * @param      string $comparison, among ModelCriteria::MODEL_CLAUSE
  * @param      string $clause A simple pseudo-SQL clause, e.g. 'foo.BAR LIKE ?'
  */
 public function __construct(Criteria $outer, $column, $value = null, $comparison = ModelCriteria::MODEL_CLAUSE, $clause)
 {
     $this->value = $value;
     if ($column instanceof ColumnMap) {
         $this->column = $column->getName();
         $this->table = $column->getTable()->getName();
     } else {
         $dotPos = strrpos($column, '.');
         if ($dotPos === false) {
             // no dot => aliased column
             $this->table = null;
             $this->column = $column;
         } else {
             $this->table = substr($column, 0, $dotPos);
             $this->column = substr($column, $dotPos + 1, strlen($column));
         }
     }
     $this->comparison = $comparison === null ? Criteria::EQUAL : $comparison;
     $this->clause = $clause;
     $this->init($outer);
 }
开发者ID:nextbigsound,项目名称:propel-orm,代码行数:30,代码来源:ModelCriterion.php

示例5: getValidatorOptionsForColumn

 /**
  * Returns a PHP string representing options to pass to a validator for a given column.
  *
  * @param  ColumnMap $column  A ColumnMap object
  *
  * @return string    The options to pass to the validator as a PHP string
  */
 public function getValidatorOptionsForColumn(ColumnMap $column)
 {
     $options = array();
     if ($column->isForeignKey()) {
         $options[] = sprintf('\'model\' => \'%s\', \'column\' => \'%s\'', $this->getForeignTable($column)->getClassname(), $this->translateColumnName($column, true));
     } else {
         if ($column->isPrimaryKey()) {
             $options[] = sprintf('\'model\' => \'%s\', \'column\' => \'%s\'', $column->getTable()->getClassname(), $this->translateColumnName($column));
         } else {
             switch ($column->getType()) {
                 case PropelColumnTypes::CLOB:
                 case PropelColumnTypes::CHAR:
                 case PropelColumnTypes::VARCHAR:
                 case PropelColumnTypes::LONGVARCHAR:
                     if ($column->getSize()) {
                         $options[] = sprintf('\'max_length\' => %s', $column->getSize());
                     }
                     break;
             }
         }
     }
     if (!$column->isNotNull() || $column->isPrimaryKey()) {
         $options[] = '\'required\' => false';
     }
     return count($options) ? sprintf('array(%s)', implode(', ', $options)) : '';
 }
开发者ID:yasirgit,项目名称:afids,代码行数:33,代码来源:sfPropelFormGenerator.class.php

示例6: testPrimaryStringAddConfiguredColumn

 public function testPrimaryStringAddConfiguredColumn()
 {
     $this->assertFalse($this->tmap->hasPrimaryStringColumn(), 'hasPrimaryStringColumn() returns false while none set.');
     $column = new ColumnMap('BAR', $this->tmap);
     $column->setPhpName('Bar');
     $column->setType('VARCHAR');
     $column->setPrimaryString(true);
     $this->tmap->addConfiguredColumn($column);
     $this->assertTrue($this->tmap->hasPrimaryStringColumn(), 'hasPrimaryStringColumn() returns true after adding pkStr column.');
     $this->assertEquals($column, $this->tmap->getPrimaryStringColumn(), 'getPrimaryStringColumn() returns correct column.');
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:11,代码来源:TableMapTest.php

示例7: convertValueForColumn

 /**
  * Converts value for some column types
  *
  * @param  mixed     $value  The value to convert
  * @param  ColumnMap $colMap The ColumnMap object
  * @return mixed     The converted value
  */
 protected function convertValueForColumn($value, ColumnMap $colMap)
 {
     if ($colMap->getType() == 'OBJECT' && is_object($value)) {
         if (is_array($value)) {
             $value = array_map('serialize', $value);
         } else {
             $value = serialize($value);
         }
     } elseif ($colMap->getType() == 'ARRAY' && is_array($value)) {
         $value = '| ' . implode(' | ', $value) . ' |';
     } elseif ($colMap->getType() == 'ENUM') {
         if (is_array($value)) {
             $value = array_map(array($colMap, 'getValueSetKey'), $value);
         } else {
             $value = $colMap->getValueSetKey($value);
         }
     }
     return $value;
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:26,代码来源:ModelCriteria.php

示例8: addColumnMap

 /**
  * Adds a given column map to the data map.
  *
  * @param \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap $columnMap The column map
  * @return void
  */
 public function addColumnMap(ColumnMap $columnMap)
 {
     $this->columnMaps[$columnMap->getPropertyName()] = $columnMap;
 }
开发者ID:,项目名称:,代码行数:10,代码来源:

示例9: getValidatorOptionsForColumn

 /**
  * Returns a PHP string representing options to pass to a validator for a given column.
  *
  * @param  ColumnMap $column  A ColumnMap object
  *
  * @return string    The options to pass to the validator as a PHP string
  */
 public function getValidatorOptionsForColumn(ColumnMap $column)
 {
     $options = array();
     if ($column->isForeignKey()) {
         $map = call_user_func(array(constant($this->getForeignTable($column)->getClassname() . '::PEER'), 'getTableMap'));
         foreach ($map->getColumns() as $primaryKey) {
             if ($primaryKey->isPrimaryKey()) {
                 break;
             }
         }
         $options[] = sprintf('\'model\' => \'%s\', \'column\' => \'%s\'', $this->getForeignTable($column)->getClassname(), strtolower($primaryKey->getColumnName()));
     } else {
         if ($column->isPrimaryKey()) {
             $options[] = sprintf('\'model\' => \'%s\', \'column\' => \'%s\'', $column->getTable()->getClassname(), strtolower($column->getColumnName()));
         } else {
             switch ($column->getType()) {
                 case PropelColumnTypes::CLOB:
                 case PropelColumnTypes::CHAR:
                 case PropelColumnTypes::VARCHAR:
                 case PropelColumnTypes::LONGVARCHAR:
                     if ($column->getSize()) {
                         $options[] = sprintf('\'max_length\' => %s', $column->getSize());
                     }
                     break;
             }
         }
     }
     if (!$column->isNotNull() || $column->isPrimaryKey()) {
         $options[] = '\'required\' => false';
     }
     return count($options) ? sprintf('array(%s)', implode(', ', $options)) : '';
 }
开发者ID:broschb,项目名称:cyclebrain,代码行数:39,代码来源:sfPropelFormGenerator.class.php

示例10: getValidatorOptionsForColumn

 /**
  * Returns a PHP string representing options to pass to a validator for a given column.
  *
  * @param  ColumnMap $column  A ColumnMap object
  *
  * @return string    The options to pass to the validator as a PHP string
  */
 public function getValidatorOptionsForColumn(ColumnMap $column)
 {
     $options = array();
     if ($column->isForeignKey()) {
         $options[] = sprintf('\'model\' => \'%s\', \'column\' => \'%s\'', $this->getForeignTable($column)->getClassname(), $this->translateColumnName($column, true));
     } else {
         if ($column->isPrimaryKey()) {
             $options[] = sprintf('\'model\' => \'%s\', \'column\' => \'%s\'', $column->getTable()->getClassname(), $this->translateColumnName($column));
         } else {
             switch ($column->getType()) {
                 case PropelColumnTypes::CLOB:
                 case PropelColumnTypes::CHAR:
                 case PropelColumnTypes::VARCHAR:
                 case PropelColumnTypes::LONGVARCHAR:
                     if ($column->getSize()) {
                         $options[] = sprintf('\'max_length\' => %s', $column->getSize());
                     }
                     break;
                 case PropelColumnTypes::TINYINT:
                     $options[] = sprintf('\'min\' => %s, \'max\' => %s', -128, 127);
                     break;
                 case PropelColumnTypes::SMALLINT:
                     $options[] = sprintf('\'min\' => %s, \'max\' => %s', -32768, 32767);
                     break;
                 case PropelColumnTypes::INTEGER:
                     $options[] = sprintf('\'min\' => %s, \'max\' => %s', -2147483648, 2147483647);
                     break;
                 case PropelColumnTypes::BIGINT:
                     $options[] = sprintf('\'min\' => %s, \'max\' => %s', -9.223372036854776E+18, 9223372036854775807);
                     break;
             }
         }
     }
     if (!$column->isNotNull() || $column->isPrimaryKey()) {
         $options[] = '\'required\' => false';
     }
     if (null !== $column->getDefaultValue()) {
         $options[] = sprintf('\'empty_value\' => \'%s\'', $column->getDefaultValue());
     }
     return count($options) ? sprintf('array(%s)', implode(', ', $options)) : '';
 }
开发者ID:bigcalm,项目名称:urlcatcher,代码行数:48,代码来源:sfPropelFormGenerator.class.php

示例11: getColumnName

 protected function getColumnName(\ColumnMap $column)
 {
     return strtolower($column->getName());
 }
开发者ID:bombayworks,项目名称:currycms,代码行数:4,代码来源:ModelForm.php

示例12: getColumnNameAndOptions

 protected function getColumnNameAndOptions(ColumnMap $column)
 {
     $name = strtolower($column->getName());
     $relation = $column->getRelation();
     $options = array('label' => $relation ? $relation->getName() : ucfirst(str_replace("_", " ", $name)), 'id' => 'table-' . str_replace('_', '-', $column->getTableName()) . '-column-' . str_replace("_", "-", $name) . rand());
     return array($name, $options);
 }
开发者ID:varvanin,项目名称:currycms,代码行数:7,代码来源:ModelForm.php

示例13: extractValueMethod

 /**
  * Extract the value method and the required parameters for it, for given a ColumnMap's type.
  * Return an Array holding the value method as first value and its parameters as the second one.
  *
  * @param ColumnMap $column
  * @return Array
  */
 public static function extractValueMethod(ColumnMap $column)
 {
     $value_method = 'get' . $column->getPhpName();
     $params = null;
     if (in_array($column->getType(), array(PropelColumnTypes::BU_DATE, PropelColumnTypes::DATE))) {
         $params = ncChangeLogConfigHandler::getDateFormat();
     } elseif (in_array($column->getType(), array(PropelColumnTypes::BU_TIMESTAMP, PropelColumnTypes::TIMESTAMP))) {
         $params = ncChangeLogConfigHandler::getDateTimeFormat();
     } elseif ($column->getType() == PropelColumnTypes::TIME) {
         $params = ncChangeLogConfigHandler::getTimeFormat();
     }
     return array($value_method, $params);
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:20,代码来源:ncPropelChangeLogBehavior.class.php

示例14: validFieldNameProvider

 public function validFieldNameProvider()
 {
     $className = '\\Foo\\Book';
     $options = array('foo' => 'bar');
     // table maps
     $emptyTableMap = new \TableMap();
     $authorTable = new \TableMap();
     $authorTable->setClassName('\\Foo\\Author');
     $resellerTable = new \TableMap();
     $resellerTable->setClassName('\\Foo\\Reseller');
     $relationsTableMap = $this->getMock('\\TableMap');
     // relations
     $mainAuthorRelation = new \RelationMap('MainAuthor');
     $mainAuthorRelation->setType(\RelationMap::MANY_TO_ONE);
     $mainAuthorRelation->setForeignTable($authorTable);
     $authorRelation = new \RelationMap('Author');
     $authorRelation->setType(\RelationMap::ONE_TO_MANY);
     $authorRelation->setForeignTable($authorTable);
     $resellerRelation = new \RelationMap('Reseller');
     $resellerRelation->setType(\RelationMap::MANY_TO_MANY);
     $resellerRelation->setLocalTable($resellerTable);
     // configure table maps mocks
     $relationsTableMap->expects($this->any())->method('getRelations')->will($this->returnValue(array($mainAuthorRelation, $authorRelation, $resellerRelation)));
     // columns
     $titleColumn = new \ColumnMap('Title', $emptyTableMap);
     $titleColumn->setType('text');
     $titleColumn->setPhpName('Title');
     $titleFieldMapping = array('id' => false, 'type' => 'text', 'fieldName' => 'Title');
     return array(array(null, array(), $className, 'Title', $options, array('type' => null, 'association_mapping' => null, 'field_mapping' => null)), array($emptyTableMap, array(), $className, 'Title', $options, array('type' => null, 'association_mapping' => null, 'field_mapping' => null)), array($emptyTableMap, array($titleColumn), $className, 'Title', $options, array('type' => 'text', 'association_mapping' => null, 'field_mapping' => $titleFieldMapping)), array($relationsTableMap, array($titleColumn), $className, 'MainAuthor', $options, array('type' => \RelationMap::MANY_TO_ONE, 'association_mapping' => array('targetEntity' => '\\Foo\\Author', 'type' => \RelationMap::MANY_TO_ONE), 'field_mapping' => null)), array($relationsTableMap, array($titleColumn), $className, 'Authors', $options, array('type' => \RelationMap::ONE_TO_MANY, 'association_mapping' => array('targetEntity' => '\\Foo\\Author', 'type' => \RelationMap::ONE_TO_MANY), 'field_mapping' => null)), array($relationsTableMap, array($titleColumn), $className, 'Resellers', $options, array('type' => \RelationMap::MANY_TO_MANY, 'association_mapping' => array('targetEntity' => '\\Foo\\Reseller', 'type' => \RelationMap::MANY_TO_MANY), 'field_mapping' => null)));
 }
开发者ID:kosolapovvp,项目名称:SonataPropelAdminBundle,代码行数:30,代码来源:ModelManagerTest.php

示例15: bindValue

 /**
  * @see       DBAdapter::bindValue()
  *
  * @param PDOStatement $stmt
  * @param string       $parameter
  * @param mixed        $value
  * @param ColumnMap    $cMap
  * @param null|integer $position
  *
  * @return boolean
  */
 public function bindValue(PDOStatement $stmt, $parameter, $value, ColumnMap $cMap, $position = null)
 {
     $pdoType = $cMap->getPdoType();
     // FIXME - This is a temporary hack to get around apparent bugs w/ PDO+MYSQL
     // See http://pecl.php.net/bugs/bug.php?id=9919
     if ($pdoType == PDO::PARAM_BOOL) {
         $value = (int) $value;
         $pdoType = PDO::PARAM_INT;
         return $stmt->bindValue($parameter, $value, $pdoType);
     } elseif ($cMap->isTemporal()) {
         $value = $this->formatTemporalValue($value, $cMap);
     } elseif (is_resource($value) && $cMap->isLob()) {
         // we always need to make sure that the stream is rewound, otherwise nothing will
         // get written to database.
         rewind($value);
     }
     return $stmt->bindValue($parameter, $value, $pdoType);
 }
开发者ID:keneanung,项目名称:gw2spidy,代码行数:29,代码来源:DBMySQL.php


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