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


PHP ClassMetadata::getQuotedTableName方法代码示例

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


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

示例1: exists

 /**
  * Checks whether the given managed entity exists in the database.
  *
  * @param object $entity
  * @return boolean TRUE if the entity exists in the database, FALSE otherwise.
  */
 public function exists($entity, array $extraConditions = array())
 {
     $criteria = $this->_class->getIdentifierValues($entity);
     if ($extraConditions) {
         $criteria = array_merge($criteria, $extraConditions);
     }
     $sql = 'SELECT 1 FROM ' . $this->_class->getQuotedTableName($this->_platform) . ' ' . $this->_getSQLTableAlias($this->_class->name) . ' WHERE ' . $this->_getSelectConditionSQL($criteria);
     return (bool) $this->_conn->fetchColumn($sql, array_values($criteria));
 }
开发者ID:halljb57,项目名称:flextrine,代码行数:15,代码来源:BasicEntityPersister.php

示例2: _generateInsertSQL

 /**
  * Generates the INSERT SQL used by the persister to persist entities.
  * 
  * @return string
  * @internal Result is cached by getInsertSQL() per request.
  */
 protected function _generateInsertSQL()
 {
     $insertSql = '';
     $columns = $this->_getInsertColumnList();
     if (empty($columns)) {
         $insertSql = $this->_platform->getEmptyIdentityInsertSQL($this->_class->getQuotedTableName($this->_platform), $this->_class->getQuotedColumnName($this->_class->identifier[0], $this->_platform));
     } else {
         $columns = array_unique($columns);
         $values = array_fill(0, count($columns), '?');
         $insertSql = 'INSERT INTO ' . $this->_class->getQuotedTableName($this->_platform) . ' (' . implode(', ', $columns) . ') ' . 'VALUES (' . implode(', ', $values) . ')';
     }
     return $insertSql;
 }
开发者ID:poulikov,项目名称:readlater,代码行数:19,代码来源:StandardEntityPersister.php

示例3: lock

 /**
  * Lock all rows of this entity matching the given criteria with the specified pessimistic lock mode
  *
  * @param array $criteria
  * @param int $lockMode
  * @return void
  */
 public function lock(array $criteria, $lockMode)
 {
     $conditionSql = $this->_getSelectConditionSQL($criteria);
     if ($lockMode == \Doctrine\DBAL\LockMode::PESSIMISTIC_READ) {
         $lockSql = $this->_platform->getReadLockSql();
     } else {
         if ($lockMode == \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) {
             $lockSql = $this->_platform->getWriteLockSql();
         }
     }
     $sql = 'SELECT 1 FROM ' . $this->_class->getQuotedTableName($this->_platform) . ' ' . $this->_getSQLTableAlias($this->_class->name) . ($conditionSql ? ' WHERE ' . $conditionSql : '') . ' ' . $lockSql;
     $params = array_values($criteria);
     $this->_conn->executeQuery($sql, $params);
 }
开发者ID:EstebanFuentealba,项目名称:PHPCodeCreator,代码行数:21,代码来源:BasicEntityPersister.php

示例4: getLockTablesSql

 /**
  * Get the FROM and optionally JOIN conditions to lock the entity managed by this persister.
  *
  * @return string
  */
 protected function getLockTablesSql()
 {
     return 'FROM ' . $this->_class->getQuotedTableName($this->_platform) . ' ' . $this->_getSQLTableAlias($this->_class->name);
 }
开发者ID:jfkz,项目名称:aquarel-cms,代码行数:9,代码来源:BasicEntityPersister.php

示例5: _gatherRelationJoinColumns

 /**
  * Gather columns and fk constraints that are required for one part of relationship.
  *
  * @param array $joinColumns
  * @param \Doctrine\DBAL\Schema\Table $theJoinTable
  * @param ClassMetadata $class
  * @param \Doctrine\ORM\Mapping\AssociationMapping $mapping
  * @param array $primaryKeyColumns
  * @param array $uniqueConstraints
  */
 private function _gatherRelationJoinColumns($joinColumns, $theJoinTable, $class, $mapping, &$primaryKeyColumns, &$uniqueConstraints)
 {
     $localColumns = array();
     $foreignColumns = array();
     $fkOptions = array();
     foreach ($joinColumns as $joinColumn) {
         $columnName = $joinColumn['name'];
         $referencedFieldName = $class->getFieldName($joinColumn['referencedColumnName']);
         if (!$class->hasField($referencedFieldName)) {
             throw new \Doctrine\ORM\ORMException("Column name `" . $joinColumn['referencedColumnName'] . "` referenced for relation from " . $mapping['sourceEntity'] . " towards " . $mapping['targetEntity'] . " does not exist.");
         }
         $primaryKeyColumns[] = $columnName;
         $localColumns[] = $columnName;
         $foreignColumns[] = $joinColumn['referencedColumnName'];
         if (!$theJoinTable->hasColumn($joinColumn['name'])) {
             // Only add the column to the table if it does not exist already.
             // It might exist already if the foreign key is mapped into a regular
             // property as well.
             $fieldMapping = $class->getFieldMapping($referencedFieldName);
             $columnDef = null;
             if (isset($joinColumn['columnDefinition'])) {
                 $columnDef = $joinColumn['columnDefinition'];
             } else {
                 if (isset($fieldMapping['columnDefinition'])) {
                     $columnDef = $fieldMapping['columnDefinition'];
                 }
             }
             $columnOptions = array('notnull' => false, 'columnDefinition' => $columnDef);
             if (isset($joinColumn['nullable'])) {
                 $columnOptions['notnull'] = !$joinColumn['nullable'];
             }
             if ($fieldMapping['type'] == "string") {
                 $columnOptions['length'] = $fieldMapping['length'];
             } else {
                 if ($fieldMapping['type'] == "decimal") {
                     $columnOptions['scale'] = $fieldMapping['scale'];
                     $columnOptions['precision'] = $fieldMapping['precision'];
                 }
             }
             $theJoinTable->addColumn($columnName, $class->getTypeOfColumn($joinColumn['referencedColumnName']), $columnOptions);
         }
         if (isset($joinColumn['unique']) && $joinColumn['unique'] == true) {
             $uniqueConstraints[] = array('columns' => array($columnName));
         }
         if (isset($joinColumn['onUpdate'])) {
             $fkOptions['onUpdate'] = $joinColumn['onUpdate'];
         }
         if (isset($joinColumn['onDelete'])) {
             $fkOptions['onDelete'] = $joinColumn['onDelete'];
         }
     }
     $theJoinTable->addUnnamedForeignKeyConstraint($class->getQuotedTableName($this->_platform), $localColumns, $foreignColumns, $fkOptions);
 }
开发者ID:prolic,项目名称:doctrine2,代码行数:63,代码来源:SchemaTool.php


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