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


PHP AbstractPlatform::getLengthExpression方法代码示例

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


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

示例1: up

 /**
  * {@inheritdoc}
  */
 public function up(Schema $schema, QueryBag $queries)
 {
     // fill createdAt and updatedAt
     $queries->addPreQuery(new ParametrizedSqlMigrationQuery('UPDATE oro_calendar_event SET created_at = :date, updated_at = :date', ['date' => new \DateTime('now', new \DateTimeZone('UTC'))], ['date' => Type::DATETIME]));
     // copy title to description if needed
     $queries->addPreQuery(new ParametrizedSqlMigrationQuery(sprintf('UPDATE oro_calendar_event SET description = title WHERE %s > 255 OR title LIKE :new_line', $this->platform->getLengthExpression('title')), ['new_line' => '%\\n%'], ['new_line' => Type::STRING]));
     // trim title
     $locateExpr = $this->platform->getLocateExpression('title', ':lf');
     $queries->addPreQuery(new ParametrizedSqlMigrationQuery(sprintf('UPDATE oro_calendar_event SET title = %s WHERE %s > 0', $this->platform->getSubstringExpression(sprintf('REPLACE(%s, :cr, :empty)', $this->platform->getSubstringExpression('title', 1, $locateExpr)), 1, 255), $locateExpr), ['lf' => '\\n', 'cr' => '\\r', 'empty' => ''], ['lf' => Type::STRING, 'cr' => Type::STRING, 'empty' => Type::STRING]));
     $queries->addPreQuery(sprintf('UPDATE oro_calendar_event SET title = %s WHERE %s > 255', $this->platform->getSubstringExpression('title', 1, 255), $this->platform->getLengthExpression('title')));
     $table = $schema->getTable('oro_calendar_event');
     $table->getColumn('title')->setType(Type::getType(Type::STRING))->setOptions(['length' => 255]);
     $table->getColumn('created_at')->setOptions(['notnull' => true]);
     $table->getColumn('updated_at')->setOptions(['notnull' => true]);
     $this->enableDataAudit($table);
 }
开发者ID:Maksold,项目名称:platform,代码行数:19,代码来源:OroCalendarBundle.php

示例2: length

 /**
  * Returns the length of text field $column.
  *
  * @param string $column
  *
  * @return string
  */
 public function length($column)
 {
     return $this->platform->getLengthExpression($column);
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:11,代码来源:DoctrineExpression.php


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