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


PHP OMBuilder::getPackage方法代码示例

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


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

示例1: getPackage

 /**
  * Gets the package for the [base] object classes.
  * @return     string
  */
 public function getPackage()
 {
     return parent::getPackage() . ".om";
 }
开发者ID:nextbigsound,项目名称:propel-orm,代码行数:8,代码来源:QueryBuilder.php

示例2: getPackage

 /**
  * Gets the package for the map builder classes.
  * @return     string
  */
 public function getPackage()
 {
     return parent::getPackage() . '.map';
 }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:8,代码来源:PHP5MapBuilderBuilder.php

示例3: addInitialize

 /**
  * Adds the addInitialize() method to the  table map class.
  * @param      string &$script The script will be modified in this method.
  */
 protected function addInitialize(&$script)
 {
     $table = $this->getTable();
     $platform = $this->getPlatform();
     $script .= "\n\t/**\n\t * Initialize the table attributes, columns and validators\n\t * Relations are not initialized by this method since they are lazy loaded\n\t *\n\t * @return     void\n\t * @throws     PropelException\n\t */\n\tpublic function initialize()\n\t{\n\t  // attributes\n\t\t\$this->setName('" . $table->getName() . "');\n\t\t\$this->setPhpName('" . $table->getPhpName() . "');\n\t\t\$this->setClassname('" . addslashes($this->getStubObjectBuilder()->getFullyQualifiedClassname()) . "');\n\t\t\$this->setPackage('" . parent::getPackage() . "');";
     if ($table->getIdMethod() == "native") {
         $script .= "\n\t\t\$this->setUseIdGenerator(true);";
     } else {
         $script .= "\n\t\t\$this->setUseIdGenerator(false);";
     }
     if ($table->getIdMethodParameters()) {
         $params = $table->getIdMethodParameters();
         $imp = $params[0];
         $script .= "\n\t\t\$this->setPrimaryKeyMethodInfo('" . $imp->getValue() . "');";
     } elseif ($table->getIdMethod() == IDMethod::NATIVE && ($platform->getNativeIdMethod() == PropelPlatformInterface::SEQUENCE || $platform->getNativeIdMethod() == PropelPlatformInterface::SERIAL)) {
         $script .= "\n\t\t\$this->setPrimaryKeyMethodInfo('" . $platform->getSequenceName($table) . "');";
     }
     if ($this->getTable()->getChildrenColumn()) {
         $script .= "\n\t\t\$this->setSingleTableInheritance(true);";
     }
     // Add columns to map
     $script .= "\n\t\t// columns";
     foreach ($table->getColumns() as $col) {
         $cup = strtoupper($col->getName());
         $cfc = $col->getPhpName();
         if (!$col->getSize()) {
             $size = "null";
         } else {
             $size = $col->getSize();
         }
         $default = $col->getDefaultValueString();
         if ($col->isPrimaryKey()) {
             if ($col->isForeignKey()) {
                 foreach ($col->getForeignKeys() as $fk) {
                     $script .= "\n\t\t\$this->addForeignPrimaryKey('{$cup}', '{$cfc}', '" . $col->getType() . "' , '" . $fk->getForeignTableName() . "', '" . strtoupper($fk->getMappedForeignColumn($col->getName())) . "', " . ($col->isNotNull() ? 'true' : 'false') . ", " . $size . ", {$default});";
                 }
             } else {
                 $script .= "\n\t\t\$this->addPrimaryKey('{$cup}', '{$cfc}', '" . $col->getType() . "', " . var_export($col->isNotNull(), true) . ", " . $size . ", {$default});";
             }
         } else {
             if ($col->isForeignKey()) {
                 foreach ($col->getForeignKeys() as $fk) {
                     $script .= "\n\t\t\$this->addForeignKey('{$cup}', '{$cfc}', '" . $col->getType() . "', '" . $fk->getForeignTableName() . "', '" . strtoupper($fk->getMappedForeignColumn($col->getName())) . "', " . ($col->isNotNull() ? 'true' : 'false') . ", " . $size . ", {$default});";
                 }
             } else {
                 $script .= "\n\t\t\$this->addColumn('{$cup}', '{$cfc}', '" . $col->getType() . "', " . var_export($col->isNotNull(), true) . ", " . $size . ", {$default});";
             }
         }
         // if col-is prim key
         if ($col->isEnumType()) {
             $script .= "\n\t\t\$this->getColumn('{$cup}', false)->setValueSet(" . var_export($col->getValueSet(), true) . ");";
         }
         if ($col->isPrimaryString()) {
             $script .= "\n\t\t\$this->getColumn('{$cup}', false)->setPrimaryString(true);";
         }
     }
     // foreach
     // validators
     $script .= "\n\t\t// validators";
     foreach ($table->getValidators() as $val) {
         $col = $val->getColumn();
         $cup = strtoupper($col->getName());
         foreach ($val->getRules() as $rule) {
             if ($val->getTranslate() !== Validator::TRANSLATE_NONE) {
                 $script .= "\n\t\t\$this->addValidator('{$cup}', '" . $rule->getName() . "', '" . $rule->getClass() . "', '" . str_replace("'", "\\'", $rule->getValue()) . "', " . $val->getTranslate() . "('" . str_replace("'", "\\'", $rule->getMessage()) . "'));";
             } else {
                 $script .= "\n\t\t\$this->addValidator('{$cup}', '" . $rule->getName() . "', '" . $rule->getClass() . "', '" . str_replace("'", "\\'", $rule->getValue()) . "', '" . str_replace("'", "\\'", $rule->getMessage()) . "');";
             }
             // if ($rule->getTranslation() ...
         }
         // foreach rule
     }
     // foreach validator
     $script .= "\n\t} // initialize()\n";
 }
开发者ID:rubensayshi,项目名称:propelsandbox,代码行数:79,代码来源:PHP5TableMapBuilder.php

示例4: getPackage

 /**
  * Gets the package for the [base] object classes.
  * @return     string
  */
 public function getPackage()
 {
     return ($this->getChild()->getPackage() ? $this->getChild()->getPackage() : parent::getPackage()) . ".om";
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:8,代码来源:QueryInheritanceBuilder.php

示例5: getPackage

 /**
  * Gets the package for the [base] object classes.
  * @return     string
  */
 public function getPackage()
 {
     return $this->getChild()->getPackage() ? $this->getChild()->getPackage() : parent::getPackage();
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:8,代码来源:ExtensionQueryInheritanceBuilder.php

示例6: addInitialize

	/**
	 * Adds the addInitialize() method to the  table map class.
	 * @param      string &$script The script will be modified in this method.
	 */
	protected function addInitialize(&$script)
	{

		$table = $this->getTable();
		$platform = $this->getPlatform();
		$ddlBuilder = $this->getDDLBuilder();

		$script .= "
	/**
	 * Initialize the table attributes, columns and validators
	 * Relations are not initialized by this method since they are lazy loaded
	 *
	 * @return     void
	 * @throws     PropelException
	 */
	public function initialize()
	{
	  // attributes
		\$this->setName('".$table->getName()."');
		\$this->setPhpName('".$table->getPhpName()."');
		\$this->setClassname('" . $this->getObjectClassname() . "');
		\$this->setPackage('" . parent::getPackage() . "');";
		if ($table->getIdMethod() == "native") {
			$script .= "
		\$this->setUseIdGenerator(true);";
		} else {
			$script .= "
		\$this->setUseIdGenerator(false);";
		}

		if ($table->getIdMethodParameters()) {
			$params = $table->getIdMethodParameters();
			$imp = $params[0];
			$script .= "
		\$this->setPrimaryKeyMethodInfo('".$imp->getValue()."');";
		} elseif ($table->getIdMethod() == IDMethod::NATIVE && ($platform->getNativeIdMethod() == Platform::SEQUENCE || $platform->getNativeIdMethod() == Platform::SERIAL)) {
			$script .= "
		\$this->setPrimaryKeyMethodInfo('".$this->prefixTablename($ddlBuilder->getSequenceName())."');";
		}

		// Add columns to map
			$script .= "
		// columns";
		foreach ($table->getColumns() as $col) {
			$cup=strtoupper($col->getName());
		  $cfc=$col->getPhpName();
			if (!$col->getSize()) {
				$size = "null";
			} else {
				$size = $col->getSize();
			}
			$default = $col->getDefaultValueString();
			if ($col->isPrimaryKey()) {
				if ($col->isForeignKey()) {
					foreach ($col->getForeignKeys() as $fk) {
						$script .= "
		\$this->addForeignPrimaryKey('$cup', '$cfc', '".$col->getType()."' , '".$fk->getForeignTableName()."', '".strtoupper($fk->getMappedForeignColumn($col->getName()))."', ".($col->isNotNull() ? 'true' : 'false').", ".$size.", $default);";
					}
				} else {
					$script .= "
		\$this->addPrimaryKey('$cup', '$cfc', '".$col->getType()."', ".var_export($col->isNotNull(), true).", ".$size.", $default);";
				}
			} else {
				if ($col->isForeignKey()) {
					foreach ($col->getForeignKeys() as $fk) {
						$script .= "
		\$this->addForeignKey('$cup', '$cfc', '".$col->getType()."', '".$fk->getForeignTableName()."', '".strtoupper($fk->getMappedForeignColumn($col->getName()))."', ".($col->isNotNull() ? 'true' : 'false').", ".$size.", $default);";
					}
			} else {
					$script .= "
		\$this->addColumn('$cup', '$cfc', '".$col->getType()."', ".var_export($col->isNotNull(), true).", ".$size.", $default);";
				}
			} // if col-is prim key
		} // foreach

		// validators
    $script .= "
		// validators";
		foreach ($table->getValidators() as $val) {
			$col = $val->getColumn();
			$cup = strtoupper($col->getName());
			foreach ($val->getRules() as $rule) {
				if ($val->getTranslate() !== Validator::TRANSLATE_NONE) {
					$script .= "
		\$this->addValidator('$cup', '".$rule->getName()."', '".$rule->getClass()."', '".str_replace("'", "\'", $rule->getValue())."', ".$val->getTranslate()."('".str_replace("'", "\'", $rule->getMessage())."'));";
				} else {
					$script .= "
		\$this->addValidator('$cup', '".$rule->getName()."', '".$rule->getClass()."', '".str_replace("'", "\'", $rule->getValue())."', '".str_replace("'", "\'", $rule->getMessage())."');";
				} // if ($rule->getTranslation() ...
  			} // foreach rule
		}  // foreach validator

		$script .= "
	} // initialize()
";

//.........这里部分代码省略.........
开发者ID:nationalfield,项目名称:symfony,代码行数:101,代码来源:PHP5TableMapBuilder.php


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