當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Platforms\AbstractPlatform類代碼示例

本文整理匯總了PHP中Doctrine\DBAL\Platforms\AbstractPlatform的典型用法代碼示例。如果您正苦於以下問題:PHP AbstractPlatform類的具體用法?PHP AbstractPlatform怎麽用?PHP AbstractPlatform使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了AbstractPlatform類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Doctrine\DBAL\Platforms\AbstractPlatform類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。