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


PHP Table::getPhpName方法代码示例

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


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

示例1: buildFormType

 /**
  * Build a form based on the given table.
  * 
  * @param BundleInterface $bundle
  * @param Table           $table
  * @param string          $formTypeNamespace
  *
  * @return string
  */
 public function buildFormType(BundleInterface $bundle, Table $table, $formTypeNamespace)
 {
     $modelName = $table->getPhpName();
     $formTypeContent = file_get_contents(__DIR__ . '/../Resources/skeleton/FormType.php');
     $formTypeContent = str_replace('##NAMESPACE##', $bundle->getNamespace() . str_replace('/', '\\', $formTypeNamespace), $formTypeContent);
     $formTypeContent = str_replace('##CLASS##', $modelName . 'Type', $formTypeContent);
     $formTypeContent = str_replace('##FQCN##', sprintf('%s\\%s', $table->getNamespace(), $modelName), $formTypeContent);
     $formTypeContent = str_replace('##TYPE_NAME##', strtolower($modelName), $formTypeContent);
     $formTypeContent = str_replace('##BUILD_CODE##', $this->buildFormFields($table), $formTypeContent);
     return $formTypeContent;
 }
开发者ID:naldz,项目名称:cyberden,代码行数:20,代码来源:FormBuilder.php

示例2: testSetCustomPhpName

 public function testSetCustomPhpName()
 {
     $table = new Table('created_at');
     $table->setPhpName('CreatedAt');
     $this->assertSame('CreatedAt', $table->getPhpName());
     $this->assertSame('createdAt', $table->getCamelCaseName());
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:7,代码来源:TableTest.php

示例3: addUseRelatedQuery

 /**
  * Adds a useRelatedQuery method for this object.
  * @param string &$script The script will be modified in this method.
  */
 protected function addUseRelatedQuery(&$script, Table $fkTable, $queryClass, $relationName, $joinType)
 {
     $script .= "\n    /**\n     * Use the {$relationName} relation " . $fkTable->getPhpName() . " object\n     *\n     * @see useQuery()\n     *\n     * @param     string \$relationAlias optional alias for the relation,\n     *                                   to be used as main alias in the secondary query\n     * @param     string \$joinType Accepted values are null, 'left join', 'right join', 'inner join'\n     *\n     * @return {$queryClass} A secondary query class using the current class as primary query\n     */\n    public function use" . $relationName . "Query(\$relationAlias = null, \$joinType = " . $joinType . ")\n    {\n        return \$this\n            ->join" . $relationName . "(\$relationAlias, \$joinType)\n            ->useQuery(\$relationAlias ? \$relationAlias : '{$relationName}', '{$queryClass}');\n    }\n";
 }
开发者ID:ktounet,项目名称:Propel2,代码行数:8,代码来源:QueryBuilder.php

示例4: addToArrayKeyLookUp

 /**
  * Adds the switch-statement for looking up the array-key name for toArray
  * @see toArray
  */
 protected function addToArrayKeyLookUp($phpName, Table $table, $plural)
 {
     if ($phpName == "") {
         $phpName = $table->getPhpName();
     }
     $camelCaseName = $table->getCamelCaseName();
     $fieldName = $table->getName();
     if ($plural) {
         $phpName = $this->getPluralizer()->getPluralForm($phpName);
         $camelCaseName = $this->getPluralizer()->getPluralForm($camelCaseName);
         $fieldName = $this->getPluralizer()->getPluralForm($fieldName);
     }
     return "\n                switch (\$keyType) {\n                    case TableMap::TYPE_CAMELNAME:\n                        \$key = '" . $camelCaseName . "';\n                        break;\n                    case TableMap::TYPE_FIELDNAME:\n                        \$key = '" . $fieldName . "';\n                        break;\n                    default:\n                        \$key = '" . $phpName . "';\n                }\n        ";
 }
开发者ID:SwissalpS,项目名称:Propel2,代码行数:18,代码来源:ObjectBuilder.php

示例5: getFQConstantName

 /**
  * Returns the full column constant name (e.g. TableMapName::COL_COLUMN_NAME).
  *
  * @return string A column constant name for insertion into PHP code
  */
 public function getFQConstantName()
 {
     $classname = $this->parentTable->getPhpName() . 'TableMap';
     $const = $this->getConstantName();
     return $classname . '::' . $const;
 }
开发者ID:bondarovich,项目名称:Propel2,代码行数:11,代码来源:Column.php

示例6: getClassNameFromTable

 /**
  * This declares the class use and returns the correct name to use
  *
  * @param Table $table
  * @param bool $fqcn
  * @return string
  */
 public function getClassNameFromTable(Table $table, $fqcn = false)
 {
     $namespace = $table->getNamespace();
     $class = $table->getPhpName();
     return $this->declareClassNamespace($class, $namespace, true);
 }
开发者ID:disider,项目名称:Propel2,代码行数:13,代码来源:AbstractOMBuilder.php

示例7: appendTableNode

 /**
  * Appends the generated <table> XML node to its parent node.
  *
  * @param Table    $table      The Table model instance
  * @param \DOMNode $parentNode The parent DOMNode object
  */
 private function appendTableNode(Table $table, \DOMNode $parentNode)
 {
     $tableNode = $parentNode->appendChild($this->document->createElement('table'));
     $tableNode->setAttribute('name', $table->getCommonName());
     $database = $table->getDatabase();
     $schema = $table->getSchema();
     if ($schema && $schema !== $database->getSchema()) {
         $tableNode->setAttribute('schema', $schema);
     }
     if (IdMethod::NO_ID_METHOD !== ($idMethod = $table->getIdMethod())) {
         $tableNode->setAttribute('idMethod', $idMethod);
     }
     if ($phpName = $table->getPhpName()) {
         $tableNode->setAttribute('phpName', $phpName);
     }
     $package = $table->getPackage();
     if ($package && !$table->isPackageOverriden()) {
         $tableNode->setAttribute('package', $package);
     }
     if ($namespace = $table->getNamespace()) {
         $tableNode->setAttribute('namespace', $namespace);
     }
     if ($table->isSkipSql()) {
         $tableNode->setAttribute('skipSql', 'true');
     }
     if ($table->isAbstract()) {
         $tableNode->setAttribute('abstract', 'true');
     }
     if ($interface = $table->getInterface()) {
         $tableNode->setAttribute('interface', $interface);
     }
     if ($table->isCrossRef()) {
         $tableNode->setAttribute('isCrossRef', 'true');
     }
     $phpNamingMethod = $table->getPhpNamingMethod();
     if ($phpNamingMethod && $phpNamingMethod !== $database->getDefaultPhpNamingMethod()) {
         $tableNode->setAttribute('phpNamingMethod', $phpNamingMethod);
     }
     if ($baseClass = $table->getBaseClass()) {
         $tableNode->setAttribute('baseClass', $baseClass);
     }
     if ($baseQueryClass = $table->getBaseQueryClass()) {
         $tableNode->setAttribute('baseQueryClass', $baseQueryClass);
     }
     if ($table->isReadOnly()) {
         $tableNode->setAttribute('readOnly', 'true');
     }
     if ($table->isReloadOnInsert()) {
         $tableNode->setAttribute('reloadOnInsert', 'true');
     }
     if ($table->isReloadOnUpdate()) {
         $tableNode->setAttribute('reloadOnUpdate', 'true');
     }
     if (null !== ($referenceOnly = $table->isForReferenceOnly())) {
         $tableNode->setAttribute('forReferenceOnly', $referenceOnly ? 'true' : 'false');
     }
     if ($alias = $table->getAlias()) {
         $tableNode->setAttribute('alias', $alias);
     }
     if ($description = $table->getDescription()) {
         $tableNode->setAttribute('description', $description);
     }
     $defaultStringFormat = $table->getDefaultStringFormat();
     if (Table::DEFAULT_STRING_FORMAT !== $defaultStringFormat) {
         $tableNode->setAttribute('defaultStringFormat', $defaultStringFormat);
     }
     $defaultAccessorVisibility = $table->getDefaultAccessorVisibility();
     if ($defaultAccessorVisibility !== Table::VISIBILITY_PUBLIC) {
         $tableNode->setAttribute('defaultAccessorVisibility', $defaultAccessorVisibility);
     }
     $defaultMutatorVisibility = $table->getDefaultMutatorVisibility();
     if ($defaultMutatorVisibility !== Table::VISIBILITY_PUBLIC) {
         $tableNode->setAttribute('defaultMutatorVisibility', $defaultMutatorVisibility);
     }
     foreach ($table->getColumns() as $column) {
         $this->appendColumnNode($column, $tableNode);
     }
     foreach ($table->getForeignKeys() as $foreignKey) {
         $this->appendForeignKeyNode($foreignKey, $tableNode);
     }
     foreach ($table->getIdMethodParameters() as $parameter) {
         $this->appendIdMethodParameterNode($parameter, $tableNode);
     }
     foreach ($table->getIndices() as $index) {
         $this->appendIndexNode($index, $tableNode);
     }
     foreach ($table->getUnices() as $index) {
         $this->appendUniqueIndexNode($index, $tableNode);
     }
     foreach ($table->getVendorInformation() as $vendorInformation) {
         $this->appendVendorInformationNode($vendorInformation, $tableNode);
     }
     foreach ($table->getBehaviors() as $behavior) {
         $this->appendBehaviorNode($behavior, $tableNode);
//.........这里部分代码省略.........
开发者ID:SwissalpS,项目名称:Propel2,代码行数:101,代码来源:XmlDumper.php

示例8: removeTable

 public function removeTable(Table $table)
 {
     if ($this->hasTable($table->getName(), true)) {
         foreach ($this->tables as $id => $tableExam) {
             if ($table->getName() === $tableExam->getName()) {
                 unset($this->tables[$id]);
             }
         }
         unset($this->tablesByName[$table->getName()]);
         unset($this->tablesByLowercaseName[strtolower($table->getName())]);
         unset($this->tablesByPhpName[$table->getPhpName()]);
     }
 }
开发者ID:SwissalpS,项目名称:Propel2,代码行数:13,代码来源:Database.php


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