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


PHP Entity::getName方法代码示例

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


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

示例1: generateNoSuchModelException

 private function generateNoSuchModelException(Entity $entity)
 {
     $className = "NoSuch{$entity->getName()}Exception";
     $content = "<?php\nclass {$className} extends Exception {\n\n}\n?>";
     $destination = "src/exceptions/{$className}.php";
     FileUtil::storeFileContents($destination, $content);
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:7,代码来源:ExceptionGenerator.php

示例2: save

 public function save(Entity $entity)
 {
     $data = array('name' => $entity->getName(), 'email' => $entity->getEmail(), 'phone' => $entity->getPhone(), 'message' => $entity->getMessage(), 'date' => $entity->getDate());
     if ($entity->getId() > 0) {
         $this->db->update($this->table, $data, $entity->getId());
     } else {
         $entity->setId($this->db->insert($this->table, $data));
     }
 }
开发者ID:rashidyusmen,项目名称:myproject,代码行数:9,代码来源:contact.php

示例3: save

 public function save(Entity $entity)
 {
     $item = array('name' => $entity->getName(), 'address' => $entity->getAddress(), 'image' => $entity->getImage(), 'date_added' => $entity->getDateAdded());
     if ($entity->getId() > 0) {
         $this->update($item, array('id' => $entity->getId()));
     } else {
         $this->add($item);
     }
 }
开发者ID:AnyB1s,项目名称:softacad2015,代码行数:9,代码来源:Address.php

示例4: save

 public function save(Entity $entity)
 {
     $item = array('user_id' => $entity->getUserId(), 'name' => $entity->getName(), 'price' => $entity->getPrice(), 'quantity' => $entity->getQuantity(), 'image' => $entity->getImage(), 'date_added' => $entity->getDateAdded());
     if ($entity->getId() > 0) {
         $this->update($item, array('id' => $entity->getId()));
     } else {
         $this->add($item);
     }
 }
开发者ID:AnyB1s,项目名称:softacad2015,代码行数:9,代码来源:Product.php

示例5: save

 public function save(Entity $entity)
 {
     $data = array('product_id' => $entity->getProductId(), 'date' => $entity->getDate(), 'name' => $entity->getName(), 'email' => $entity->getEmail(), 'phone' => $entity->getPhone(), 'is_complete' => $entity->getIsComplete(), 'user_id' => $entity->getUserId());
     if ($entity->getId() > 0) {
         $this->db->update($this->table, $data, $entity->getId());
     } else {
         $entity->setId($this->db->insert($this->table, $data));
     }
 }
开发者ID:rashidyusmen,项目名称:myproject,代码行数:9,代码来源:orders.php

示例6: save

 public function save(Entity $entity)
 {
     $data = array('name' => $entity->getName(), 'content' => $entity->getContent(), 'date' => date('Y-m-d H:i:s', strtotime($entity->getDate())), 'news_id' => $this->news_id);
     if ($entity->getId() > 0) {
         $this->db->update($this->table, $data, $entity->getId());
     } else {
         $entity->setId($this->db->insert($this->table, $data));
     }
 }
开发者ID:rashidyusmen,项目名称:myproject,代码行数:9,代码来源:newscomment.php

示例7: save

 public function save(Entity $entity)
 {
     $dataInput = array('name' => $entity->getName(), 'image' => $entity->getImage(), 'category_id' => $entity->getCategoryId(), 'description' => $entity->getDescription());
     if ($entity->getId() > 0) {
         $this->update($entity->getId(), $dataInput);
     } else {
         $this->create($dataInput);
     }
 }
开发者ID:dbcdeathdreamer,项目名称:SoftAcad,代码行数:9,代码来源:ToursCollection.php

示例8: save

 public function save(Entity $entity)
 {
     $item = array('product_id' => $entity->getProductId(), 'name' => $entity->getName(), 'image' => $entity->getImage(), 'is_cover' => $entity->getIsCover(), 'date_added' => $entity->getDateAdded());
     if ($entity->getId() > 0) {
         $this->update($item, array('id' => $entity->getId()));
     } else {
         $this->add($item);
     }
 }
开发者ID:AnyB1s,项目名称:softacad2015,代码行数:9,代码来源:ProductImage.php

示例9: generate

 public function generate(Entity $entity)
 {
     $className = "{$entity->getName()}Service";
     $destination = "src/impl/service/{$className}.php";
     if (FileUtil::fileExists($destination)) {
         return;
     }
     $content = "<?php\nclass {$className} extends {$className}Base {\n\n}\n?>";
     FileUtil::storeFileContents($destination, $content);
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:10,代码来源:EntityServiceGenerator.php

示例10: getOppositeEntity

 public function getOppositeEntity(Entity $entity)
 {
     if ($entity == $this->getOneEntity()) {
         return $this->getOtherEntity();
     } else {
         if ($entity == $this->getOtherEntity()) {
             return $this->getOneEntity();
         } else {
             throw new Exception("Entity '" . $entity->getName() . "' is related to neither '" . $this->getOneEntity()->getName() . "' nor '" . $this->getOtherEntity()->getName() . "'.");
         }
     }
 }
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:12,代码来源:Relationship.class.php

示例11: generate

 public function generate(Entity $entity)
 {
     $className = "{$entity->getName()}Model";
     $content = "<?php\nabstract class {$className} extends Model {\n\n";
     $content .= $this->gettersAndSetters($entity);
     $content .= $this->getOneToManyGetters($entity);
     $content .= $this->getOneToManyMappedGettersSetters($entity);
     $content .= $this->getManyToManyGetters($entity);
     $content .= "}\n?>";
     // Write file to class
     $destination = "src/service/model/{$className}.php";
     FileUtil::storeFileContents($destination, $content);
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:13,代码来源:EntityModelGenerator.php

示例12: generateCustomServices

 private function generateCustomServices(Entity $entity)
 {
     $result = "";
     $methods = ReflectionUtil::getSubclassMethods($entity->getName() . "Service");
     foreach ($methods as $method) {
         if (!$method->isPublic()) {
             continue;
         }
         $name = $method->name;
         $paramNames = array();
         foreach ($method->getParameters() as $param) {
             $paramNames[] = "\$" . $param->name;
         }
         $skeleton = $name . "(" . implode(", ", $paramNames) . ")";
         $result .= "\tpublic static function {$skeleton} {\n" . "\t\treturn self::getService()->{$skeleton};\n" . "\t}\n\n";
     }
     return $result;
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:18,代码来源:EntityServiceUtilGenerator.php

示例13: showForEntity

 /**
  * Show users of an entity
  *
  * @param $entity Entity object
  **/
 static function showForEntity(Entity $entity)
 {
     global $DB;
     $ID = $entity->getField('id');
     if (!$entity->can($ID, READ)) {
         return false;
     }
     $canedit = $entity->canEdit($ID);
     $canshowuser = User::canView();
     $nb_per_line = 3;
     $rand = mt_rand();
     if ($canedit) {
         $headerspan = $nb_per_line * 2;
     } else {
         $headerspan = $nb_per_line;
     }
     if ($canedit) {
         echo "<div class='firstbloc'>";
         echo "<form name='entityuser_form{$rand}' id='entityuser_form{$rand}' method='post' action='";
         echo Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_1'><th colspan='6'>" . __('Add an authorization to a user') . "</tr>";
         echo "<tr class='tab_bg_1'><td class='tab_bg_2 center'>" . __('User') . "&nbsp;";
         echo "<input type='hidden' name='entities_id' value='{$ID}'>";
         User::dropdown(array('right' => 'all'));
         echo "</td><td class='tab_bg_2 center'>" . self::getTypeName(1) . "</td><td>";
         Profile::dropdownUnder(array('value' => Profile::getDefault()));
         echo "</td><td class='tab_bg_2 center'>" . __('Recursive') . "</td><td>";
         Dropdown::showYesNo("is_recursive", 0);
         echo "</td><td class='tab_bg_2 center'>";
         echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
         echo "</div>";
     }
     $query = "SELECT DISTINCT `glpi_profiles`.`id`, `glpi_profiles`.`name`\n                FROM `glpi_profiles_users`\n                LEFT JOIN `glpi_profiles`\n                     ON (`glpi_profiles_users`.`profiles_id` = `glpi_profiles`.`id`)\n                LEFT JOIN `glpi_users` ON (`glpi_users`.`id` = `glpi_profiles_users`.`users_id`)\n                WHERE `glpi_profiles_users`.`entities_id` = '{$ID}'\n                     AND `glpi_users`.`is_deleted` = '0'";
     $result = $DB->query($query);
     $nb = $DB->numrows($result);
     echo "<div class='spaced'>";
     if ($canedit && $nb) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('container' => 'mass' . __CLASS__ . $rand, 'specific_actions' => array('purge' => _x('button', 'Delete permanently')));
         Html::showMassiveActions($massiveactionparams);
     }
     echo "<table class='tab_cadre_fixehov'>";
     echo "<thead><tr>";
     echo "<th class='noHover' colspan='{$headerspan}'>";
     printf(__('%1$s (%2$s)'), _n('User', 'Users', Session::getPluralNumber()), __('D=Dynamic, R=Recursive'));
     echo "</th></tr></thead>";
     if ($nb) {
         Session::initNavigateListItems('User', sprintf(__('%1$s = %2$s'), Entity::getTypeName(1), $entity->getName()));
         while ($data = $DB->fetch_assoc($result)) {
             echo "<tbody><tr class='noHover'>";
             $reduce_header = 0;
             if ($canedit && $nb) {
                 echo "<th width='10'>";
                 echo Html::checkAllAsCheckbox("profile" . $data['id'] . "_{$rand}");
                 echo "</th>";
                 $reduce_header++;
             }
             echo "<th colspan='" . ($headerspan - $reduce_header) . "'>";
             printf(__('%1$s: %2$s'), __('Profile'), $data["name"]);
             echo "</th></tr></tbody>";
             echo "<tbody id='profile" . $data['id'] . "_{$rand}'>";
             $query = "SELECT `glpi_users`.*,\n                             `glpi_profiles_users`.`id` AS linkID,\n                             `glpi_profiles_users`.`is_recursive`,\n                             `glpi_profiles_users`.`is_dynamic`\n                      FROM `glpi_profiles_users`\n                      LEFT JOIN `glpi_users`\n                           ON (`glpi_users`.`id` = `glpi_profiles_users`.`users_id`)\n                      WHERE `glpi_profiles_users`.`entities_id` = '{$ID}'\n                            AND `glpi_users`.`is_deleted` = '0'\n                            AND `glpi_profiles_users`.`profiles_id` = '" . $data['id'] . "'\n                      ORDER BY `glpi_profiles_users`.`profiles_id`,\n                               `glpi_users`.`name`,\n                               `glpi_users`.`realname`,\n                               `glpi_users`.`firstname`";
             $result2 = $DB->query($query);
             if ($DB->numrows($result2) > 0) {
                 $i = 0;
                 while ($data2 = $DB->fetch_assoc($result2)) {
                     Session::addToNavigateListItems('User', $data2["id"]);
                     if ($i % $nb_per_line == 0) {
                         if ($i != 0) {
                             echo "</tr>";
                         }
                         echo "<tr class='tab_bg_1'>";
                     }
                     if ($canedit) {
                         echo "<td width='10'>";
                         Html::showMassiveActionCheckBox(__CLASS__, $data2["linkID"]);
                         echo "</td>";
                     }
                     $username = formatUserName($data2["id"], $data2["name"], $data2["realname"], $data2["firstname"], $canshowuser);
                     if ($data2["is_dynamic"] || $data2["is_recursive"]) {
                         $username = sprintf(__('%1$s %2$s'), $username, "<span class='b'>(");
                         if ($data2["is_dynamic"]) {
                             $username = sprintf(__('%1$s%2$s'), $username, __('D'));
                         }
                         if ($data2["is_dynamic"] && $data2["is_recursive"]) {
                             $username = sprintf(__('%1$s%2$s'), $username, ", ");
                         }
                         if ($data2["is_recursive"]) {
                             $username = sprintf(__('%1$s%2$s'), $username, __('R'));
                         }
                         $username = sprintf(__('%1$s%2$s'), $username, ")</span>");
//.........这里部分代码省略.........
开发者ID:Ixertec,项目名称:glpi,代码行数:101,代码来源:profile_user.class.php

示例14: getObjectProperty

 /**
  * Fetches a single property of the given object and returns its plain, unformatted value.
  * 
  * @param Entity $entity
  * @param type $id
  * @param type $propertyName
  * @param array $params
  * @return property value or NULL if not present
  */
 public function getObjectProperty(Entity $entity, $id, $propertyName, array $params)
 {
     $queryContext = new QueryContext($params, $entity);
     // Always include blobs
     $query = new QueryEntity($entity, $queryContext, Scope::parseValue(Scope::VALUE_P_ALL), $id);
     $query->setPropertyNames(array($propertyName));
     $mySQLi = $this->schema->getMySQLi();
     $queryString = $query->getQueryString();
     $queryResult = $mySQLi->query($queryString);
     if (!$queryResult) {
         throw new Exception("Error fetching property '{$propertyName}' of '" . $entity->getName() . "' - " . $mySQLi->error . "\n<!--\n{$queryString}\n-->");
     }
     $queryData = $queryResult->fetch_assoc();
     $output = NULL;
     if ($queryData) {
         $output = $queryData[$propertyName];
     }
     $queryResult->close();
     return $output;
 }
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:29,代码来源:ObjectFetcher.class.php

示例15: getScope

 public function getScope(Entity $entity, Scope $defaultScope)
 {
     if (array_key_exists($entity->getName(), $this->scopeMap)) {
         return $this->scopeMap[$entity->getName()];
     } else {
         return $defaultScope;
     }
 }
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:8,代码来源:QueryContext.class.php


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