本文整理汇总了PHP中Doctrine\DBAL\Platforms\AbstractPlatform类的典型用法代码示例。如果您正苦于以下问题:PHP AbstractPlatform类的具体用法?PHP AbstractPlatform怎么用?PHP AbstractPlatform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AbstractPlatform类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: validatePlatform
/**
* @param AbstractPlatform $platform
*
* @throws UnsupportedPlatformException
*/
protected function validatePlatform(AbstractPlatform $platform)
{
$platformName = $platform->getName();
if (isset($this->platforms) && !in_array($platformName, $this->platforms)) {
throw UnsupportedPlatformException::unsupportedPlatform($platformName);
}
}
开发者ID:raketman,项目名称:doctrine2-spatial,代码行数:12,代码来源:AbstractGeometryDQLFunction.php
示例2: getSQLDeclaration
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
if (!isset($fieldDeclaration['length'])) {
$fieldDeclaration['length'] = 32;
}
return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
}
开发者ID:foowie,项目名称:ip,代码行数:7,代码来源:IP.php
示例3: convertToDatabaseValue
/**
* @param DateTimeOfDay $value
* @param AbstractPlatform $platform
*
* @return string
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value instanceof DateTimeOfDay) {
return $value->toDateTime()->format($platform->getDateTimeFormatString());
}
return parent::convertToDatabaseValue($value, $platform);
}
开发者ID:zelenin,项目名称:value-object,代码行数:13,代码来源:DateTimeOfDayType.php
示例4: processQueueCallback
/**
* ->processQueueCallback(function (\Dja\Db\Model\Metadata $metadata, \Doctrine\DBAL\Schema\Table $table, array $sql, \Doctrine\DBAL\Connection $db) {})
* @param callable|\Closure $callBack
*/
public function processQueueCallback(\Closure $callBack)
{
$callbackQueue = [];
while (count($this->generateQueue)) {
$modelName = array_shift($this->generateQueue);
try {
/** @var Metadata $metadata */
$metadata = $modelName::metadata();
$tblName = $metadata->getDbTableName();
if ($this->db->getSchemaManager()->tablesExist($tblName)) {
continue;
}
if (isset($this->generated[$tblName])) {
continue;
}
$table = $this->metadataToTable($metadata);
$this->generated[$tblName] = 1;
$sql = $this->dp->getCreateTableSQL($table, AbstractPlatform::CREATE_INDEXES);
array_unshift($callbackQueue, [$metadata, $table, $sql]);
$fks = $table->getForeignKeys();
if (count($fks)) {
$sql = [];
foreach ($fks as $fk) {
$sql[] = $this->dp->getCreateForeignKeySQL($fk, $table);
}
array_push($callbackQueue, [$metadata, $table, $sql]);
}
} catch (\Exception $e) {
pr($e->__toString());
}
}
foreach ($callbackQueue as $args) {
$callBack($args[0], $args[1], $args[2], $this->db);
}
}
开发者ID:buldezir,项目名称:dja_orm,代码行数:39,代码来源:Creation.php
示例5: getSqlDeclaration
public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
$values = array_map(function ($val) {
return "'" . $val . "'";
}, $this->values);
return sprintf("ENUM(%s) COMMENT '%s'", implode(', ', $values), $platform->getDoctrineTypeComment($this));
}
开发者ID:pscheit,项目名称:psc-cms,代码行数:7,代码来源:EnumType.php
示例6: convertToDatabaseValueSQL
/**
* @param string $sqlExpr
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
* @throws \Kdyby\Doctrine\NotImplementedException
* @return string
*/
public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
{
if (!$platform instanceof Doctrine\DBAL\Platforms\MySqlPlatform) {
throw new Kdyby\Doctrine\NotImplementedException("Unsupported platform " . $platform->getName());
}
return 'GeomFromText(' . $sqlExpr . ')';
}
开发者ID:Richmond77,项目名称:learning-nette,代码行数:13,代码来源:GeometryType.php
示例7: setUp
protected function setUp()
{
$this->platform = $this->getMockBuilder('Doctrine\\DBAL\\Platforms\\AbstractPlatform')->setMethods(array('getVarcharTypeDeclarationSQL'))->getMockForAbstractClass();
$this->platform->expects($this->any())->method('getVarcharTypeDeclarationSQL')->will($this->returnValue('DUMMYVARCHAR()'));
$this->type = Type::getType('phone_number');
$this->phoneNumberUtil = PhoneNumberUtil::getInstance();
}
开发者ID:skafandri,项目名称:phone-number-bundle,代码行数:7,代码来源:PhoneNumberTypeTest.php
示例8: convertToDatabaseValue
public function convertToDatabaseValue($timepoint, AbstractPlatform $platform)
{
if ($timepoint !== null) {
$dtime = $timepoint->asPHPDateTime();
return $dtime->format($platform->getDateTimeFormatString());
}
}
开发者ID:rouffj,项目名称:timemachine,代码行数:7,代码来源:TimePointType.php
示例9: getSqlDeclaration
public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
$fieldDeclaration['length'] = 255;
$fieldDeclaration['notnull'] = false;
$fieldDeclaration['default'] = null;
return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
}
开发者ID:baszoetekouw,项目名称:janus,代码行数:7,代码来源:JanusUserTypeType.php
示例10: setUp
protected function setUp()
{
// class has private constructor
$this->type = $this->getMockBuilder('Oro\\Bundle\\LocaleBundle\\DoctrineExtensions\\DBAL\\Types\\UTCTimeType')->setMethods(null)->disableOriginalConstructor()->getMock();
$this->platform = $this->getMockBuilder('Doctrine\\DBAL\\Platforms\\AbstractPlatform')->disableOriginalConstructor()->setMethods(array('getTimeFormatString'))->getMockForAbstractClass();
$this->platform->expects($this->any())->method('getTimeFormatString')->will($this->returnValue('H:i:s'));
}
开发者ID:Maksold,项目名称:platform,代码行数:7,代码来源:UTCTimeTypeTest.php
示例11: getSQLDeclaration
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
if ($platform->getName() === 'postgresql') {
return 'GEOMETRY';
}
return strtoupper($this->getName());
}
开发者ID:brick,项目名称:geo,代码行数:10,代码来源:GeometryType.php
示例12: getSQLDeclaration
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
$fieldDeclaration['length'] = 25;
$fieldDeclaration['fixed'] = true;
$fieldDeclaration['notnull'] = true;
return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
}
开发者ID:baszoetekouw,项目名称:janus,代码行数:7,代码来源:JanusDateTimeType.php
示例13: getSQLDeclaration
/**
* {@inheritdoc}
* @param array $fieldDeclaration
* @param AbstractPlatform $platform
* @return
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
if (empty($fieldDeclaration['length'])) {
$fieldDeclaration['length'] = Path::MAX_LENGTH;
}
$type = $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
return $type;
}
开发者ID:sitesupra,项目名称:sitesupra,代码行数:14,代码来源:PathType.php
示例14: convertToDatabaseValue
/** @noinspection PhpMissingParentCallCommonInspection
* @inheritdoc
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
/** @var DateTime|null $value */
if ($value === null) {
return null;
}
return $value->format($platform->getDateTimeFormatString());
}
开发者ID:limoncello-php,项目名称:json-api,代码行数:11,代码来源:DateTimeJsonApiNativeType.php
示例15: convertToPHPValue
/** @noinspection PhpMissingParentCallCommonInspection
* @inheritdoc
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
/** @var string|null $value */
if ($value === null) {
return null;
}
return $this->convertDateTimeString($value, $platform->getDateTimeFormatString(), static::JSON_API_FORMAT);
}
开发者ID:limoncello-php,项目名称:json-api,代码行数:11,代码来源:DateTimeDefaultStringType.php
示例16: getSQLDeclaration
/** {@inheritdoc} */
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
switch ($platform->getName()) {
case 'mysql':
return 'TINYINT' . (isset($fieldDeclaration['unsigned']) && $fieldDeclaration['unsigned'] ? ' UNSIGNED' : '');
default:
return $platform->getSmallIntTypeDeclarationSQL($fieldDeclaration);
}
}
开发者ID:ntd1712,项目名称:common,代码行数:10,代码来源:TinyIntType.php
示例17: getSQLDeclaration
/**
* {@inheritdoc}
* @param array $fieldDeclaration
* @param AbstractPlatform $platform
* @return string
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
$fieldDeclaration['length'] = 20;
$fieldDeclaration['fixed'] = true;
$sql = $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
//todo: check if this is sane, at least
$sql .= ' COLLATE ascii_general_ci';
return $sql;
}
开发者ID:sitesupra,项目名称:sitesupra,代码行数:15,代码来源:SupraIdType.php
示例18: convertToDatabaseValue
/**
* {@inheritdoc}
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value === null) {
return null;
}
if ($value instanceof Carbon) {
return $value->copy()->setTimezone('UTC')->format($platform->getDateTimeFormatString());
}
throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateTimeFormatString());
}
开发者ID:Zn4rK,项目名称:laravel-template,代码行数:13,代码来源:CarbonType.php
示例19: getSqlDeclaration
/**
* @param array $fieldDeclaration
* @param AbstractPlatform $platform
* @return string
*/
public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
$values = implode(', ', array_map(function ($value) {
return "'{$value}'";
}, $this->getValues()));
if (!$platform instanceof MySqlPlatform) {
return $platform->getClobTypeDeclarationSQL($fieldDeclaration);
}
return sprintf('SET(%s)', $values);
}
开发者ID:adevyatov,项目名称:DoctrineSetTypeBundle,代码行数:15,代码来源:AbstractSetType.php
示例20: convertToPHPValue
/**
* @param mixed $value
* @param AbstractPlatform $platform
*
* @return null|FamilyInterface
* @throws MissingFamilyException
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if (null === $value) {
return null;
}
$listeners = $platform->getEventManager()->getListeners('sidus_family_configuration');
/** @var FamilyConfigurationHandler $familyConfigurationHandler */
$familyConfigurationHandler = array_shift($listeners);
return $familyConfigurationHandler->getFamily($value);
}
开发者ID:VincentChalnot,项目名称:SidusEAVModelBundle,代码行数:17,代码来源:FamilyType.php
注:本文中的Doctrine\DBAL\Platforms\AbstractPlatform类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论