本文整理汇总了PHP中AbstractPlatform类的典型用法代码示例。如果您正苦于以下问题:PHP AbstractPlatform类的具体用法?PHP AbstractPlatform怎么用?PHP AbstractPlatform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AbstractPlatform类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: convertToPHPValue
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if ($value === null) {
return null;
}
$val = \DateTime::createFromFormat($platform->getDateTimeFormatString(), $value, self::$utc ? self::$utc : (self::$utc = new \DateTimeZone(\DateTimeZone::UTC)));
if (!$val) {
throw ConversionException::conversionFailed($value, $this->getName());
}
return $val;
}
开发者ID:vincentdieltiens,项目名称:doctrine-utc-datetime,代码行数:11,代码来源:UTCDateTimeType.php
示例2: getSqlDeclaration
public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
return $platform->getBigIntTypeDeclarationSql($fieldDeclaration);
}
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:4,代码来源:BigIntType.php
示例3: convertToPHPValue
/**
* {@inheritdoc}
*
* @override
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
return $value !== null ? \DateTime::createFromFormat($platform->getTimeFormatString(), $value) : null;
}
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:9,代码来源:TimeType.php
示例4: convertToDatabaseValue
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
return $platform->convertBooleans($value);
}
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:4,代码来源:BooleanType.php
示例5: getQuotedDiscriminatorColumnName
/**
* Gets the (possibly quoted) name of the discriminator column for safe use
* in an SQL statement.
*
* @param AbstractPlatform $platform
* @return string
*/
public function getQuotedDiscriminatorColumnName($platform)
{
return isset($this->discriminatorColumn['quoted']) ? $platform->quoteIdentifier($this->discriminatorColumn['name']) : $this->discriminatorColumn['name'];
}
开发者ID:nvdnkpr,项目名称:symfony-demo,代码行数:11,代码来源:ClassMetadata.php
示例6: getQuotedJoinColumnName
/**
* Gets the (possibly quoted) column name of a join column that is safe to use
* in an SQL statement.
*
* @param string $joinColumn
* @param AbstractPlatform $platform
* @return string
*/
public function getQuotedJoinColumnName($joinColumn, $platform)
{
return isset($this->joinColumns[$joinColumn]['quoted']) ? $platform->quoteIdentifier($joinColumn) : $joinColumn;
}
开发者ID:nvdnkpr,项目名称:symfony-demo,代码行数:12,代码来源:OneToOneMapping.php
示例7: getQuotedColumnName
/**
* Gets the (possibly quoted) column name of a mapped field for safe use
* in an SQL statement.
*
* @param string $field
* @param AbstractPlatform $platform
* @return string
*/
public function getQuotedColumnName($field, $platform)
{
return isset($this->fieldMappings[$field]['quoted']) ?
$platform->quoteIdentifier($this->fieldMappings[$field]['columnName']) :
$this->fieldMappings[$field]['columnName'];
}
开发者ID:regisg27,项目名称:Propel2,代码行数:14,代码来源:ClassMetadataInfo.php
示例8: getQuotedJoinTableName
/**
* Gets the (possibly quoted) name of the join table.
*
* @param AbstractPlatform $platform
* @return string
*/
public function getQuotedJoinTableName(array $assoc, $platform)
{
return isset($assoc['joinTable']['quoted']) ? $platform->quoteIdentifier($assoc['joinTable']['name']) : $assoc['joinTable']['name'];
}
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:10,代码来源:ClassMetadata.php
示例9: getQuotedTableName
/**
* Gets the (possibly quoted) primary table name of this class for safe use
* in an SQL statement.
*
* @param AbstractPlatform $platform
* @return string
*/
public function getQuotedTableName($platform)
{
return isset($this->table['quoted']) ? $platform->quoteIdentifier($this->table['name']) : $this->table['name'];
}
开发者ID:sentact,项目名称:vendor-doctrine2,代码行数:11,代码来源:ClassMetadata.php
示例10: getDefaultLength
/** @override */
public function getDefaultLength(AbstractPlatform $platform)
{
return $platform->getVarcharDefaultLength();
}
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:5,代码来源:StringType.php
示例11: completeIdGeneratorMapping
/**
* Completes the ID generator mapping. If "auto" is specified we choose the generator
* most appropriate for the targeted database platform.
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $class
*/
private function completeIdGeneratorMapping(ClassMetadataInfo $class)
{
$idGenType = $class->generatorType;
if ($idGenType == ClassMetadata::GENERATOR_TYPE_AUTO) {
if ($this->targetPlatform->prefersSequences()) {
$class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_SEQUENCE);
} else {
if ($this->targetPlatform->prefersIdentityColumns()) {
$class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_IDENTITY);
} else {
$class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_TABLE);
}
}
}
// Create & assign an appropriate ID generator instance
switch ($class->generatorType) {
case ClassMetadata::GENERATOR_TYPE_IDENTITY:
// For PostgreSQL IDENTITY (SERIAL) we need a sequence name. It defaults to
// <table>_<column>_seq in PostgreSQL for SERIAL columns.
// Not pretty but necessary and the simplest solution that currently works.
$seqName = $this->targetPlatform instanceof Platforms\PostgreSQLPlatform ? $class->getTableName() . '_' . $class->columnNames[$class->identifier[0]] . '_seq' : null;
$class->setIdGenerator(new \Doctrine\ORM\Id\IdentityGenerator($seqName));
break;
case ClassMetadata::GENERATOR_TYPE_SEQUENCE:
// If there is no sequence definition yet, create a default definition
$definition = $class->sequenceGeneratorDefinition;
if (!$definition) {
$sequenceName = $class->getTableName() . '_' . $class->getSingleIdentifierColumnName() . '_seq';
$definition['sequenceName'] = $this->targetPlatform->fixSchemaElementName($sequenceName);
$definition['allocationSize'] = 1;
$definition['initialValue'] = 1;
$class->setSequenceGeneratorDefinition($definition);
}
$sequenceGenerator = new \Doctrine\ORM\Id\SequenceGenerator($definition['sequenceName'], $definition['allocationSize']);
$class->setIdGenerator($sequenceGenerator);
break;
case ClassMetadata::GENERATOR_TYPE_NONE:
$class->setIdGenerator(new \Doctrine\ORM\Id\AssignedGenerator());
break;
case ClassMetadata::GENERATOR_TYPE_UUID:
$class->setIdGenerator(new \Doctrine\ORM\Id\UuidGenerator());
break;
case ClassMetadata::GENERATOR_TYPE_TABLE:
throw new ORMException("TableGenerator not yet implemented.");
break;
case ClassMetadata::GENERATOR_TYPE_CUSTOM:
$definition = $class->customGeneratorDefinition;
if (!class_exists($definition['class'])) {
throw new ORMException("Can't instantiate custom generator : " . $definition['class']);
}
$class->setIdGenerator(new $definition['class']());
break;
default:
throw new ORMException("Unknown generator type: " . $class->generatorType);
}
}
开发者ID:davidbui2,项目名称:doctrine2,代码行数:62,代码来源:ClassMetadataFactory.php
示例12: _generateInsertSql
/**
* Generates the INSERT SQL used by the persister to persist entities.
*
* @return string
*/
protected function _generateInsertSql()
{
$insertSql = '';
$columns = $this->_getInsertColumnList();
if (empty($columns)) {
$insertSql = $this->_platform->getEmptyIdentityInsertSql($this->_class->getQuotedTableName($this->_platform), $this->_class->getQuotedColumnName($this->_class->identifier[0], $this->_platform));
} else {
$columns = array_unique($columns);
$values = array_fill(0, count($columns), '?');
$insertSql = 'INSERT INTO ' . $this->_class->getQuotedTableName($this->_platform) . ' (' . implode(', ', $columns) . ') ' . 'VALUES (' . implode(', ', $values) . ')';
}
return $insertSql;
}
开发者ID:nvdnkpr,项目名称:symfony-demo,代码行数:18,代码来源:StandardEntityPersister.php
示例13: _getSelectJoinColumnsSQL
/**
* Gets the SQL snippet for all join columns of the given class that are to be
* placed in an SQL SELECT statement.
*
* @return string
*/
protected function _getSelectJoinColumnsSQL(ClassMetadata $class)
{
$sql = '';
foreach ($class->associationMappings as $assoc) {
if ($assoc->isOwningSide && $assoc->isOneToOne()) {
foreach ($assoc->targetToSourceKeyColumns as $srcColumn) {
$columnAlias = $srcColumn . $this->_sqlAliasCounter++;
$sql .= ', ' . $this->_getSQLTableAlias($this->_class) . ".{$srcColumn} AS {$columnAlias}";
$resultColumnName = $this->_platform->getSQLResultCasing($columnAlias);
if (!isset($this->_resultColumnNames[$resultColumnName])) {
$this->_resultColumnNames[$resultColumnName] = $srcColumn;
}
}
}
}
return $sql;
}
开发者ID:poulikov,项目名称:readlater,代码行数:23,代码来源:StandardEntityPersister.php
示例14: walkSubselectFromClause
/**
* Walks down a SubselectFromClause AST node, thereby generating the appropriate SQL.
*
* @param SubselectFromClause
* @return string The SQL.
*/
public function walkSubselectFromClause($subselectFromClause)
{
$identificationVarDecls = $subselectFromClause->identificationVariableDeclarations;
$sqlParts = array();
foreach ($identificationVarDecls as $subselectIdVarDecl) {
$sql = '';
$rangeDecl = $subselectIdVarDecl->rangeVariableDeclaration;
$dqlAlias = $rangeDecl->aliasIdentificationVariable;
$class = $this->_em->getClassMetadata($rangeDecl->abstractSchemaName);
$sql .= $class->getQuotedTableName($this->_platform) . ' ' . $this->getSqlTableAlias($class->table['name'], $dqlAlias);
if ($class->isInheritanceTypeJoined()) {
$sql .= $this->_generateClassTableInheritanceJoins($class, $dqlAlias);
}
foreach ($subselectIdVarDecl->joinVariableDeclarations as $joinVarDecl) {
$sql .= $this->walkJoinVariableDeclaration($joinVarDecl);
}
$sqlParts[] = $this->_platform->appendLockHint($sql, $this->_query->getHint(Query::HINT_LOCK_MODE));
}
return ' FROM ' . implode(', ', $sqlParts);
}
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:26,代码来源:SqlWalker.php
示例15: getDefaultValueDeclarationSql
/**
* @override
*/
public function getDefaultValueDeclarationSql($field)
{
if (!empty($field['nextval'])) {
return ' NOT NULL';
} else {
return parent::getDefaultValueDeclarationSql($field);
}
}
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:11,代码来源:PostgreSqlPlatform.php
示例16: __construct
/**
* Creates a new MySqlPlatform instance.
*/
public function __construct()
{
parent::__construct();
}
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:7,代码来源:MySqlPlatform.php
示例17: walkSubselectFromClause
/**
* Walks down a SubselectFromClause AST node, thereby generating the appropriate SQL.
*
* @param SubselectFromClause
* @return string The SQL.
*/
public function walkSubselectFromClause($subselectFromClause)
{
$identificationVarDecls = $subselectFromClause->identificationVariableDeclarations;
$sqlParts = array();
foreach ($identificationVarDecls as $subselectIdVarDecl) {
$sql = $this->platform->appendLockHint($this->walkRangeVariableDeclaration($subselectIdVarDecl->rangeVariableDeclaration), $this->query->getHint(Query::HINT_LOCK_MODE));
foreach ($subselectIdVarDecl->joins as $join) {
$sql .= $this->walkJoin($join);
}
$sqlParts[] = $sql;
}
return ' FROM ' . implode(', ', $sqlParts);
}
开发者ID:bardascat,项目名称:blogify,代码行数:19,代码来源:SqlWalker.php
示例18: _getTransactionIsolationLevelSql
/**
* Enter description here...
*
* @param unknown_type $level
* @override
*/
protected function _getTransactionIsolationLevelSql($level)
{
switch ($level) {
case Doctrine_DBAL_Connection::TRANSACTION_READ_UNCOMMITTED:
return 'READ COMMITTED RECORD_VERSION';
case Doctrine_DBAL_Connection::TRANSACTION_READ_COMMITTED:
return 'READ COMMITTED NO RECORD_VERSION';
case Doctrine_DBAL_Connection::TRANSACTION_REPEATABLE_READ:
return 'SNAPSHOT';
case Doctrine_DBAL_Connection::TRANSACTION_SERIALIZABLE:
return 'SNAPSHOT TABLE STABILITY';
default:
return parent::_getTransactionIsolationLevelSql($level);
}
}
开发者ID:jackbravo,项目名称:doctrine,代码行数:21,代码来源:FirebirdPlatform.php
示例19: _getTransactionIsolationLevelSql
protected function _getTransactionIsolationLevelSql($level)
{
switch ($level) {
// case \Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED:
// return 0;
// case \Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED:
// case \Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ:
// case \Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE:
// return 1;
default:
return parent::_getTransactionIsolationLevelSql($level);
}
}
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:13,代码来源:SqlitePlatform.php
示例20: getCreateIndexSQL
/**
* @override
*/
public function getCreateIndexSQL(Index $index, $table)
{
$constraint = parent::getCreateIndexSQL($index, $table);
if ($index->isUnique()) {
$constraint = $this->_appendUniqueConstraintDefinition($constraint, $index);
}
return $constraint;
}
开发者ID:ricardofontanelli,项目名称:LswDoctrinePdoDblib,代码行数:11,代码来源:MsSqlPlatform.php
注:本文中的AbstractPlatform类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论