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


PHP ORMException::notSupported方法代码示例

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


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

示例1: _gatherRelationsSql

 /**
  * Gathers the SQL for properly setting up the relations of the given class.
  * This includes the SQL for foreign key constraints and join tables.
  *
  * @param ClassMetadata $class
  * @param \Doctrine\DBAL\Schema\Table $table
  * @param \Doctrine\DBAL\Schema\Schema $schema
  * @return void
  */
 private function _gatherRelationsSql($class, $table, $schema)
 {
     foreach ($class->associationMappings as $fieldName => $mapping) {
         if (isset($class->inheritedAssociationFields[$fieldName])) {
             continue;
         }
         $foreignClass = $this->_em->getClassMetadata($mapping->targetEntityName);
         if ($mapping->isOneToOne() && $mapping->isOwningSide) {
             $primaryKeyColumns = $uniqueConstraints = array();
             // unnecessary for this relation-type
             $this->_gatherRelationJoinColumns($mapping->joinColumns, $table, $foreignClass, $mapping, $primaryKeyColumns, $uniqueConstraints);
         } else {
             if ($mapping->isOneToMany() && $mapping->isOwningSide) {
                 //... create join table, one-many through join table supported later
                 throw ORMException::notSupported();
             } else {
                 if ($mapping->isManyToMany() && $mapping->isOwningSide) {
                     // create join table
                     $joinTable = $mapping->joinTable;
                     $theJoinTable = $schema->createTable($mapping->getQuotedJoinTableName($this->_platform));
                     $primaryKeyColumns = $uniqueConstraints = array();
                     // Build first FK constraint (relation table => source table)
                     $this->_gatherRelationJoinColumns($joinTable['joinColumns'], $theJoinTable, $class, $mapping, $primaryKeyColumns, $uniqueConstraints);
                     // Build second FK constraint (relation table => target table)
                     $this->_gatherRelationJoinColumns($joinTable['inverseJoinColumns'], $theJoinTable, $foreignClass, $mapping, $primaryKeyColumns, $uniqueConstraints);
                     foreach ($uniqueConstraints as $indexName => $unique) {
                         $theJoinTable->addUniqueIndex($unique['columns'], is_numeric($indexName) ? null : $indexName);
                     }
                     $theJoinTable->setPrimaryKey($primaryKeyColumns);
                 }
             }
         }
     }
 }
开发者ID:andreia,项目名称:doctrine,代码行数:43,代码来源:SchemaTool.php

示例2: _gatherRelationsSql

 /**
  * Gathers the SQL for properly setting up the relations of the given class.
  * This includes the SQL for foreign key constraints and join tables.
  *
  * @param ClassMetadata $class
  * @param \Doctrine\DBAL\Schema\Table $table
  * @param \Doctrine\DBAL\Schema\Schema $schema
  * @return void
  */
 private function _gatherRelationsSql($class, $table, $schema)
 {
     foreach ($class->associationMappings as $fieldName => $mapping) {
         if (isset($mapping['inherited'])) {
             continue;
         }
         $foreignClass = $this->em->getClassMetadata($mapping['targetEntity']);
         if ($mapping['type'] & ClassMetadata::TO_ONE && $mapping['isOwningSide']) {
             $primaryKeyColumns = $uniqueConstraints = array();
             // PK is unnecessary for this relation-type
             $this->_gatherRelationJoinColumns($mapping['joinColumns'], $table, $foreignClass, $mapping, $primaryKeyColumns, $uniqueConstraints);
             foreach ($uniqueConstraints as $indexName => $unique) {
                 $table->addUniqueIndex($unique['columns'], is_numeric($indexName) ? null : $indexName);
             }
         } else {
             if ($mapping['type'] == ClassMetadata::ONE_TO_MANY && $mapping['isOwningSide']) {
                 //... create join table, one-many through join table supported later
                 throw ORMException::notSupported();
             } else {
                 if ($mapping['type'] == ClassMetadata::MANY_TO_MANY && $mapping['isOwningSide']) {
                     // create join table
                     $joinTable = $mapping['joinTable'];
                     $theJoinTable = $schema->createTable($this->quoteStrategy->getJoinTableName($mapping, $foreignClass, $this->platform));
                     $primaryKeyColumns = $uniqueConstraints = array();
                     // Build first FK constraint (relation table => source table)
                     $this->_gatherRelationJoinColumns($joinTable['joinColumns'], $theJoinTable, $class, $mapping, $primaryKeyColumns, $uniqueConstraints);
                     // Build second FK constraint (relation table => target table)
                     $this->_gatherRelationJoinColumns($joinTable['inverseJoinColumns'], $theJoinTable, $foreignClass, $mapping, $primaryKeyColumns, $uniqueConstraints);
                     $theJoinTable->setPrimaryKey($primaryKeyColumns);
                     foreach ($uniqueConstraints as $indexName => $unique) {
                         $theJoinTable->addUniqueIndex($unique['columns'], is_numeric($indexName) ? null : $indexName);
                     }
                 }
             }
         }
     }
 }
开发者ID:Herriniaina,项目名称:iVarotra,代码行数:46,代码来源:SchemaTool.php

示例3: gatherRelationsSql

 /**
  * Gathers the SQL for properly setting up the relations of the given class.
  * This includes the SQL for foreign key constraints and join tables.
  *
  * @param ClassMetadata $class
  * @param Table         $table
  * @param Schema        $schema
  * @param array         $addedFks
  * @param array         $blacklistedFks
  *
  * @return void
  *
  * @throws \Doctrine\ORM\ORMException
  */
 private function gatherRelationsSql($class, $table, $schema, &$addedFks, &$blacklistedFks)
 {
     foreach ($class->associationMappings as $mapping) {
         if (isset($mapping['inherited'])) {
             continue;
         }
         $foreignClass = $this->em->getClassMetadata($mapping['targetEntity']);
         if ($mapping['type'] & ClassMetadata::TO_ONE && $mapping['isOwningSide']) {
             $primaryKeyColumns = [];
             // PK is unnecessary for this relation-type
             $this->gatherRelationJoinColumns($mapping['joinColumns'], $table, $foreignClass, $mapping, $primaryKeyColumns, $addedFks, $blacklistedFks);
         } elseif ($mapping['type'] == ClassMetadata::ONE_TO_MANY && $mapping['isOwningSide']) {
             //... create join table, one-many through join table supported later
             throw ORMException::notSupported();
         } elseif ($mapping['type'] == ClassMetadata::MANY_TO_MANY && $mapping['isOwningSide']) {
             // create join table
             $joinTable = $mapping['joinTable'];
             $theJoinTable = $schema->createTable($this->quoteStrategy->getJoinTableName($mapping, $foreignClass, $this->platform));
             $primaryKeyColumns = [];
             // Build first FK constraint (relation table => source table)
             $this->gatherRelationJoinColumns($joinTable['joinColumns'], $theJoinTable, $class, $mapping, $primaryKeyColumns, $addedFks, $blacklistedFks);
             // Build second FK constraint (relation table => target table)
             $this->gatherRelationJoinColumns($joinTable['inverseJoinColumns'], $theJoinTable, $foreignClass, $mapping, $primaryKeyColumns, $addedFks, $blacklistedFks);
             $theJoinTable->setPrimaryKey($primaryKeyColumns);
         }
     }
 }
开发者ID:AdactiveSAS,项目名称:doctrine2,代码行数:41,代码来源:SchemaTool.php


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