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


PHP Column::getTable方法代码示例

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


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

示例1: addTranslatedColumnSetter

 protected function addTranslatedColumnSetter(Column $column)
 {
     $visibility = $column->getTable()->isReadOnly() ? 'protected' : $column->getMutatorVisibility();
     $typeHint = '';
     $null = '';
     if ($column->getTypeHint()) {
         $typeHint = $column->getTypeHint();
         if ('array' !== $typeHint) {
             $typeHint = $this->declareClass($typeHint);
         }
         $typeHint .= ' ';
         if (!$column->isNotNull()) {
             $null = ' = null';
         }
     }
     $typeHint = "{$typeHint}\$v{$null}";
     $i18nTablePhpName = $this->builder->getClassNameFromBuilder($this->builder->getNewStubObjectBuilder($this->behavior->getI18nTable()));
     $tablePhpName = $this->builder->getObjectClassName();
     $objectBuilder = $this->builder->getNewObjectBuilder($this->behavior->getI18nTable());
     $comment = '';
     if ($this->isDateType($column->getType())) {
         $objectBuilder->addTemporalMutatorComment($comment, $column);
     } else {
         $objectBuilder->addMutatorComment($comment, $column);
     }
     $comment = preg_replace('/^\\t/m', '', $comment);
     $comment = str_replace('@return     $this|' . $i18nTablePhpName, '@return     $this|' . $tablePhpName, $comment);
     return $this->renderTemplate('objectTranslatedColumnSetter', ['comment' => $comment, 'column' => $column, 'visibility' => $visibility, 'typeHint' => $typeHint, 'columnPhpName' => $column->getPhpName(), 'localeColumnName' => $this->behavior->getLocaleColumn()->getPhpName()]);
 }
开发者ID:gossi,项目名称:propel-l10n-behavior,代码行数:29,代码来源:L10nBehaviorObjectBuilderModifier.php

示例2: getRemoveColumnDDL

 /**
  * Builds the DDL SQL to remove a column
  *
  * @return string
  */
 public function getRemoveColumnDDL(Column $column)
 {
     $pattern = "\nALTER TABLE %s DROP %s;\n";
     return sprintf($pattern, $this->quoteIdentifier($column->getTable()->getName()), $this->quoteIdentifier($column->getName()));
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:10,代码来源:MysqlPlatform.php

示例3: getColumnDDL

 public function getColumnDDL(Column $col)
 {
     $domain = $col->getDomain();
     $ddl = array($this->quoteIdentifier($col->getName()));
     $sqlType = $domain->getSqlType();
     $table = $col->getTable();
     if ($col->isAutoIncrement() && $table && $table->getIdMethodParameters() == null) {
         $sqlType = $col->getType() === PropelTypes::BIGINT ? 'bigserial' : 'serial';
     }
     if ($this->hasSize($sqlType) && $col->isDefaultSqlType($this)) {
         $ddl[] = $sqlType . $domain->printSize();
     } else {
         $ddl[] = $sqlType;
     }
     if ($default = $this->getColumnDefaultValueDDL($col)) {
         $ddl[] = $default;
     }
     if ($notNull = $this->getNullString($col->isNotNull())) {
         $ddl[] = $notNull;
     }
     if ($autoIncrement = $col->getAutoIncrementString()) {
         $ddl[] = $autoIncrement;
     }
     return implode(' ', $ddl);
 }
开发者ID:RafalFilipek,项目名称:Propel2,代码行数:25,代码来源:PgsqlPlatform.php

示例4: getAddColumnDDL

 /**
  * Builds the DDL SQL to add a column
  *
  * @param Column $column
  *
  * @return string
  */
 public function getAddColumnDDL(Column $column)
 {
     $pattern = "\nALTER TABLE %s ADD %s %s;\n";
     $tableColumns = $column->getTable()->getColumns();
     // Default to add first if no column is found before the current one
     $insertPositionDDL = "FIRST";
     foreach ($tableColumns as $i => $tableColumn) {
         // We found the column, use the one before it if it's not the first
         if ($tableColumn->getName() == $column->getName()) {
             // We have a column that is not the first one
             if ($i > 0) {
                 $insertPositionDDL = "AFTER " . $this->quoteIdentifier($tableColumns[$i - 1]->getName());
             }
             break;
         }
     }
     return sprintf($pattern, $this->quoteIdentifier($column->getTable()->getName()), $this->getColumnDDL($column), $insertPositionDDL);
 }
开发者ID:cocofile,项目名称:cocofile,代码行数:25,代码来源:MysqlPlatform.php

示例5: testSetTable

 public function testSetTable()
 {
     $column = new Column();
     $column->setTable($this->getTableMock('books'));
     $this->assertInstanceOf('Propel\\Generator\\Model\\Table', $column->getTable());
     $this->assertSame('books', $column->getTableName());
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:7,代码来源:ColumnTest.php

示例6: isColumnForeignKeyOrDuplicated

 /**
  * @param Column $column
  *
  * @return bool
  *
  * @throws PropelException
  */
 protected function isColumnForeignKeyOrDuplicated(Column $column)
 {
     $delegateTable = $column->getTable();
     $table = $this->getTable();
     $fks = [];
     if (!isset($this->double_defined)) {
         $this->double_defined = [];
         foreach ($this->delegates + [$table->getName() => 1] as $key => $value) {
             $delegateTable = $this->getDelegateTable($key);
             foreach ($delegateTable->getColumns() as $columnDelegated) {
                 if (isset($this->double_defined[$columnDelegated->getName()])) {
                     $this->double_defined[$columnDelegated->getName()]++;
                 } else {
                     $this->double_defined[$columnDelegated->getName()] = 1;
                 }
             }
         }
     }
     if (1 < $this->double_defined[$column->getName()]) {
         return true;
     }
     foreach ($delegateTable->getForeignKeysReferencingTable($table->getName()) as $fk) {
         /** @var \Propel\Generator\Model\ForeignKey $fk */
         $fks[] = $fk->getForeignColumnName();
     }
     foreach ($table->getForeignKeysReferencingTable($delegateTable->getName()) as $fk) {
         $fks[] = $fk->getForeignColumnName();
     }
     if (in_array($column->getName(), $fks) || $table->hasColumn($column->getName())) {
         return true;
     }
     return false;
 }
开发者ID:SwissalpS,项目名称:Propel2,代码行数:40,代码来源:DelegateBehavior.php

示例7: getChangeColumnDDL

 /**
  * Builds the DDL SQL to change a column
  * @return string
  */
 public function getChangeColumnDDL(Column $fromColumn, Column $toColumn)
 {
     $pattern = "\nALTER TABLE %s CHANGE %s %s;\n";
     return sprintf($pattern, $this->quoteIdentifier($fromColumn->getTable()->getName()), $this->quoteIdentifier($fromColumn->getName()), $this->getColumnDDL($toColumn));
 }
开发者ID:KyleGoslan,项目名称:Huge-Propel,代码行数:9,代码来源:MysqlPlatform.php

示例8: addFindOne

 protected function addFindOne(Column $column)
 {
     return $this->renderTemplate('queryFindOne', ['objectClassName' => $this->builder->getClassNameFromBuilder($this->builder->getStubObjectBuilder($column->getTable())), 'columnPhpName' => $column->getPhpName(), 'columnName' => $column->getName(), 'localeColumnName' => $this->behavior->getLocaleColumn()->getPhpName()]);
 }
开发者ID:gossi,项目名称:propel-l10n-behavior,代码行数:4,代码来源:L10nBehaviorQueryBuilderModifier.php

示例9: isColumnForeignKeyOrDuplicated

 /**
  * @param Column $column
  *
  * @return bool
  *
  * @throws PropelException
  */
 protected function isColumnForeignKeyOrDuplicated(Column $column)
 {
     $delegateTable = $column->getTable();
     $table = $this->getTable();
     $fks = [];
     foreach ($delegateTable->getForeignKeysReferencingTable($table->getName()) as $fk) {
         /** @var \Propel\Generator\Model\ForeignKey $fk */
         $fks[] = $fk->getForeignColumnName();
     }
     foreach ($table->getForeignKeysReferencingTable($delegateTable->getName()) as $fk) {
         $fks[] = $fk->getForeignColumnName();
     }
     if (in_array($column->getName(), $fks)) {
         return true;
     } else {
         if ($table->hasColumn($column->getName())) {
             throw new PropelException('Column with name «' . $column->getName() . '» (delegated from table «' . $delegateTable->getName() . '») already exists in table «' . $table->getName() . '». Probably database design mistake');
         }
         return false;
     }
 }
开发者ID:HTTPSNetsuite,项目名称:netsuite-codes,代码行数:28,代码来源:DelegateBehavior.php


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