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


PHP Type::getDescription方法代码示例

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


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

示例1: store

 /**
  * @param Type $type
  *
  * @return string
  * @throws exceptions\DBDuplicateEntryException
  * @throws exceptions\DBForeignKeyException
  */
 public function store(Type $type)
 {
     $query = 'INSERT INTO types (name, description) VALUES (:name, :description);';
     $this->db->prepare($query);
     $this->db->bindValue(':name', $type->getName());
     $this->db->bindValue(':description', $type->getDescription());
     $this->db->execute();
     return $this->db->lastInsertId();
 }
开发者ID:arkuuu,项目名称:publin,代码行数:16,代码来源:TypeModel.php

示例2: formObject

 public function formObject()
 {
     $model = new Type($this->data->id);
     $this->data->forUpdate = $this->data->id != '';
     $this->data->object = $model->getData();
     $this->data->title = $this->data->forUpdate ? $model->getDescription() : _M("New Type");
     $this->data->save = "@fnbr20/admin/type/save/" . $model->getId() . '|formObject';
     $this->data->delete = "@fnbr20/admin/type/delete/" . $model->getId() . '|formObject';
     $this->render();
 }
开发者ID:elymatos,项目名称:expressive_fnbr,代码行数:10,代码来源:TypeController.php

示例3: SelectQuery

 /**
  * Get the key of the type.
  * 
  * @param object Type $type
  * @return integer
  * @access private
  * @since 3/9/05
  */
 function _getTypeKey(Type $type)
 {
     $dbc = Services::getService("DatabaseManager");
     // Check if the type exists and return its key if found.
     $query = new SelectQuery();
     $query->addTable($this->_typeTable);
     $query->addColumn('id');
     $query->addWhere("domain='" . addslashes($type->getDomain()) . "'");
     $query->addWhere("authority='" . addslashes($type->getAuthority()) . "'", _AND);
     $query->addWhere("keyword='" . addslashes($type->getKeyword()) . "'", _AND);
     $result = $dbc->query($query, $this->_dbId);
     if ($result->getNumberOfRows() == 1) {
         return $result->field('id');
     } else {
         $result->free();
         $query = new InsertQuery();
         $query->setTable($this->_typeTable);
         $query->setAutoIncrementColumn("id", $this->_typeTable . "_id_seq");
         $query->setColumns(array('domain', 'authority', 'keyword', 'description'));
         $query->setValues(array("'" . addslashes($type->getDomain()) . "'", "'" . addslashes($type->getAuthority()) . "'", "'" . addslashes($type->getKeyword()) . "'", "'" . addslashes($type->getDescription()) . "'"));
         $result = $dbc->query($query, $this->_dbId);
         return $result->getLastAutoIncrementValue();
     }
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:32,代码来源:AgentTokenMappingManager.class.php

示例4: createRootNode

 /**
  * Attempts to create the specified node as root node in the database.
  * @access public
  * @param object nodeId The id of the node.
  * @param object type The type of the node.
  * @param string displayName The display name of the node.
  * @param string description The description of the node.
  * @return void
  **/
 function createRootNode(Id $nodeId, Type $type, $displayName, $description)
 {
     // ** parameter validation
     $stringRule = StringValidatorRule::getRule();
     ArgumentValidator::validate($displayName, $stringRule, true);
     ArgumentValidator::validate($description, $stringRule, true);
     // ** end of parameter validation
     // check that the node does not exist in the cache
     $idValue = $nodeId->getIdString();
     if ($this->_isCached($idValue)) {
         // The node has already been cached!
         throw new OperationFailedException("Node, '{$idValue}' is already cached.");
     }
     // attempt to insert the node now
     $dbHandler = Services::getService("DatabaseManager");
     // 1. Insert the type
     $domain = $type->getDomain();
     $authority = $type->getAuthority();
     $keyword = $type->getKeyword();
     $typeDescription = $type->getDescription();
     // check whether the type is already in the DB, if not insert it
     if (isset($this->harmoni_db)) {
         if (!isset($this->createRootNode_selectType_stmt)) {
             $query = $this->harmoni_db->select();
             $query->addTable("az2_node_type");
             $query->addColumn("id");
             $query->addWhereRawEqual("domain", '?');
             $query->addWhereRawEqual("authority", '?');
             $query->addWhereRawEqual("keyword", '?');
             $this->createRootNode_selectType_stmt = $query->prepare();
         }
         $this->createRootNode_selectType_stmt->bindValue(1, $domain);
         $this->createRootNode_selectType_stmt->bindValue(2, $authority);
         $this->createRootNode_selectType_stmt->bindValue(3, $keyword);
         $this->createRootNode_selectType_stmt->execute();
         $queryResult = $this->createRootNode_selectType_stmt->getResult();
     } else {
         $query = new SelectQuery();
         $query->addTable("az2_node_type");
         $query->addColumn("id");
         $query->addWhereEqual("domain", $domain);
         $query->addWhereEqual("authority", $authority);
         $query->addWhereEqual("keyword", $keyword);
         $queryResult = $dbHandler->query($query, $this->_dbIndex);
     }
     if ($queryResult->hasNext()) {
         // if the type is already in the database
         $typeIdValue = $queryResult->field("id");
         // get the id
         $queryResult->free();
     } else {
         // if not, insert it
         $queryResult->free();
         if (isset($this->harmoni_db)) {
             if (!isset($this->createRootNode_insertType_stmt)) {
                 $query = $this->harmoni_db->insert();
                 $query->setTable("az2_node_type");
                 // 					$query->setAutoIncrementColumn("id", "az2_node_type_id_seq");
                 $query->addRawValue("domain", '?');
                 $query->addRawValue("authority", '?');
                 $query->addRawValue("keyword", '?');
                 $query->addRawValue("description", '?');
                 $this->createRootNode_insertType_stmt = $query->prepare();
             }
             $this->createRootNode_insertType_stmt->bindValue(1, $domain);
             $this->createRootNode_insertType_stmt->bindValue(2, $authority);
             $this->createRootNode_insertType_stmt->bindValue(3, $keyword);
             $this->createRootNode_insertType_stmt->bindValue(4, $typeDescription);
             $this->createRootNode_insertType_stmt->execute();
             $queryResult = $this->createRootNode_insertType_stmt->getResult();
         } else {
             $query = new InsertQuery();
             $query->setTable("az2_node_type");
             $query->setAutoIncrementColumn("id", "az2_node_type_id_seq");
             $query->addValue("domain", $domain);
             $query->addValue("authority", $authority);
             $query->addValue("keyword", $keyword);
             $query->addValue("description", $typeDescription);
             $queryResult = $dbHandler->query($query, $this->_dbIndex);
         }
         $typeIdValue = $queryResult->getLastAutoIncrementValue();
     }
     // 2. Now that we know the id of the type, insert the node itself
     if (isset($this->harmoni_db)) {
         if (!isset($this->createRootNode_insertNode_stmt)) {
             $query = $this->harmoni_db->insert();
             $query->setTable("az2_node");
             $query->addRawValue("id", '?');
             $query->addRawValue("display_name", '?');
             $query->addRawValue("description", '?');
             $query->addRawValue("fk_hierarchy", '?');
//.........这里部分代码省略.........
开发者ID:adamfranco,项目名称:harmoni,代码行数:101,代码来源:HierarchyCache.class.php

示例5: array

 /**
  * Answer the database id for the type passed.
  * 
  * @param object Type $type
  * @return string
  * @access public
  * @since 3/1/06
  */
 function _getTypeId(Type $type)
 {
     if (!isset($this->_typeIds)) {
         $this->_typeIds = array();
     }
     if (!isset($this->_typeIds[$type->asString()])) {
         $dbc = Services::getService("DatabaseManager");
         $query = new SelectQuery();
         $query->addColumn("id");
         $query->addTable("log_type");
         $query->addWhere("domain = '" . addslashes($type->getDomain()) . "'");
         $query->addWhere("authority = '" . addslashes($type->getAuthority()) . "'");
         $query->addWhere("keyword = '" . addslashes($type->getKeyword()) . "'");
         $results = $dbc->query($query, $this->_dbIndex);
         if ($results->getNumberOfRows()) {
             $this->_typeIds[$type->asString()] = $results->field("id");
             $results->free();
         } else {
             $results->free();
             $query = new InsertQuery();
             $query->setTable("log_type");
             $query->setAutoIncrementColumn("id", "log_type_id_seq");
             $query->setColumns(array("domain", "authority", "keyword", "description"));
             $query->addRowOfValues(array("'" . addslashes($type->getDomain()) . "'", "'" . addslashes($type->getAuthority()) . "'", "'" . addslashes($type->getKeyword()) . "'", "'" . addslashes($type->getDescription()) . "'"));
             $results = $dbc->query($query, $this->_dbIndex);
             $this->_typeIds[$type->asString()] = $results->getLastAutoIncrementValue();
         }
     }
     return $this->_typeIds[$type->asString()];
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:38,代码来源:HarmoniWritableLog.class.php


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