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


PHP ForeignKey::getTable方法代码示例

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


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

示例1: getDropForeignKeyDDL

 public function getDropForeignKeyDDL(ForeignKey $fk)
 {
     if (!$this->supportsForeignKeys($fk->getTable())) {
         return '';
     }
     if ($fk->isSkipSql()) {
         return;
     }
     $pattern = "\nALTER TABLE %s DROP FOREIGN KEY %s;\n";
     return sprintf($pattern, $this->quoteIdentifier($fk->getTable()->getName()), $this->quoteIdentifier($fk->getName()));
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:11,代码来源:MysqlPlatform.php

示例2: getAddForeignKeyDDL

 public function getAddForeignKeyDDL(ForeignKey $fk)
 {
     if ($fk->isSkipSql() || $fk->isPolymorphic()) {
         return;
     }
     $pattern = "\nBEGIN\nALTER TABLE %s ADD %s\nEND\n;\n";
     return sprintf($pattern, $this->quoteIdentifier($fk->getTable()->getName()), $this->getForeignKeyDDL($fk));
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:8,代码来源:MssqlPlatform.php

示例3: addRefFkScheduledForDeletionAttribute

 protected function addRefFkScheduledForDeletionAttribute(&$script, ForeignKey $refFK)
 {
     $className = $this->getClassNameFromTable($refFK->getTable());
     $fkName = lcfirst($this->getRefFKPhpNameAffix($refFK, true));
     $script .= "\n    /**\n     * An array of objects scheduled for deletion.\n     * @var ObjectCollection|{$className}[]\n     */\n    protected \${$fkName}ScheduledForDeletion = null;\n";
 }
开发者ID:SwissalpS,项目名称:Propel2,代码行数:6,代码来源:ObjectBuilder.php

示例4: getRefRelatedBySuffix

 protected static function getRefRelatedBySuffix(ForeignKey $fk)
 {
     $relCol = '';
     foreach ($fk->getLocalForeignMapping() as $localColumnName => $foreignColumnName) {
         $localTable = $fk->getTable();
         $localColumn = $localTable->getColumn($localColumnName);
         if (!$localColumn) {
             throw new RuntimeException(sprintf('Could not fetch column: %s in table %s.', $localColumnName, $localTable->getName()));
         }
         $foreignKeysToForeignTable = $localTable->getForeignKeysReferencingTable($fk->getForeignTableName());
         if ($fk->getForeignTableName() == $fk->getTableName()) {
             // self referential foreign key
             $relCol .= $fk->getForeignTable()->getColumn($foreignColumnName)->getPhpName();
             if (count($foreignKeysToForeignTable) > 1) {
                 // several self-referential foreign keys
                 $relCol .= array_search($fk, $foreignKeysToForeignTable);
             }
         } elseif (count($foreignKeysToForeignTable) > 1 || count($fk->getForeignTable()->getForeignKeysReferencingTable($fk->getTableName())) > 0) {
             // several foreign keys to the same table, or symmetrical foreign key in foreign table
             $relCol .= $localColumn->getPhpName();
         }
     }
     if (!empty($relCol)) {
         $relCol = 'RelatedBy' . $relCol;
     }
     return $relCol;
 }
开发者ID:robin850,项目名称:Propel2,代码行数:27,代码来源:AbstractOMBuilder.php

示例5: getDropForeignKeyDDL

 /**
  * Builds the DDL SQL to drop a foreign key.
  *
  * @param  ForeignKey $fk
  * @return string
  */
 public function getDropForeignKeyDDL(ForeignKey $fk)
 {
     if ($fk->isSkipSql() || $fk->isPolymorphic()) {
         return;
     }
     $pattern = "\nALTER TABLE %s DROP CONSTRAINT %s;\n";
     return sprintf($pattern, $this->quoteIdentifier($fk->getTable()->getName()), $this->quoteIdentifier($fk->getName()));
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:14,代码来源:DefaultPlatform.php

示例6: getReferrerVersionsColumn

 public function getReferrerVersionsColumn(ForeignKey $fk)
 {
     $fkTableName = $fk->getTable()->getName();
     $fkIdsColumnName = $fkTableName . '_versions';
     return $this->versionTable->getColumn($fkIdsColumnName);
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:6,代码来源:VersionableBehavior.php

示例7: addCrossFKDoAdd

 /**
  * @param        string &$script The script will be modified in this method.
  * @param        ForeignKey $refFK
  * @param        ForeignKey $crossFK
  */
 protected function addCrossFKDoAdd(&$script, ForeignKey $refFK, ForeignKey $crossFK)
 {
     $relatedObjectClassName = $this->getFKPhpNameAffix($crossFK, $plural = false);
     // lcfirst() doesn't exist in PHP < 5.3
     $lowerRelatedObjectClassName = $relatedObjectClassName;
     $lowerRelatedObjectClassName[0] = strtolower($lowerRelatedObjectClassName[0]);
     $joinedTableObjectBuilder = $this->getNewObjectBuilder($refFK->getTable());
     $className = $joinedTableObjectBuilder->getObjectClassname();
     $tblFK = $refFK->getTable();
     $foreignObjectName = '$' . $tblFK->getStudlyPhpName();
     $script .= "\n    /**\n     * @param    {$relatedObjectClassName} \${$lowerRelatedObjectClassName} The {$lowerRelatedObjectClassName} object to add.\n     */\n    protected function doAdd{$relatedObjectClassName}(\${$lowerRelatedObjectClassName})\n    {\n        {$foreignObjectName} = new {$className}();\n        {$foreignObjectName}->set{$relatedObjectClassName}(\${$lowerRelatedObjectClassName});\n        \$this->add{$className}({$foreignObjectName});\n    }\n";
 }
开发者ID:rouffj,项目名称:Propel2,代码行数:17,代码来源:ObjectBuilder.php

示例8: testSetTable

 public function testSetTable()
 {
     $table = $this->getTableMock('book');
     $table->expects($this->once())->method('getSchema')->will($this->returnValue('books'));
     $fk = new ForeignKey();
     $fk->setTable($table);
     $this->assertInstanceOf('Propel\\Generator\\Model\\Table', $fk->getTable());
     $this->assertSame('books', $fk->getSchemaName());
     $this->assertSame('book', $fk->getTableName());
 }
开发者ID:disider,项目名称:Propel2,代码行数:10,代码来源:ForeignKeyTest.php

示例9: addCrossFKRemove

 /**
  * Adds the method that remove an object from the referrer fkey collection.
  * @param string $script The script will be modified in this method.
  * @param ForeignKey $refFK
  * @param ForeignKey $crossFK
  */
 protected function addCrossFKRemove(&$script, ForeignKey $refFK, ForeignKey $crossFK)
 {
     $relCol = $this->getFKPhpNameAffix($crossFK, $plural = true);
     $collName = 'coll' . $relCol;
     $tblFK = $refFK->getTable();
     $joinedTableObjectBuilder = $this->getNewObjectBuilder($refFK->getTable());
     $className = $joinedTableObjectBuilder->getObjectClassname();
     $M2MScheduledForDeletion = lcfirst($relCol) . "ScheduledForDeletion";
     $crossObjectName = '$' . $crossFK->getForeignTable()->getStudlyPhpName();
     $crossObjectClassName = $this->getNewObjectBuilder($crossFK->getForeignTable())->getObjectClassname();
     $relatedObjectClassName = $this->getFKPhpNameAffix($crossFK, $plural = false);
     $script .= "\n    /**\n     * Remove a {$crossObjectClassName} object to this object\n     * through the {$tblFK->getName()} cross reference table.\n     *\n     * @param {$crossObjectClassName} {$crossObjectName} The {$className} object to relate\n     * @return " . $this->getObjectClassname() . " The current object (for fluent API support)\n     */\n    public function remove{$relatedObjectClassName}({$crossObjectClassName} {$crossObjectName})\n    {\n        if (\$this->get{$relCol}()->contains({$crossObjectName})) {\n            \$this->{$collName}->remove(\$this->{$collName}->search({$crossObjectName}));\n\n            if (null === \$this->{$M2MScheduledForDeletion}) {\n                \$this->{$M2MScheduledForDeletion} = clone \$this->{$collName};\n                \$this->{$M2MScheduledForDeletion}->clear();\n            }\n\n            \$this->{$M2MScheduledForDeletion}[] = {$crossObjectName};\n        }\n\n        return \$this;\n    }\n";
 }
开发者ID:badelas,项目名称:thelia,代码行数:19,代码来源:ObjectBuilder.php


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