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


PHP Entry::setName方法代码示例

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


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

示例1: Entry

<?php

// submit_entry.php
require_once "bootstrap.php";
$email = $_POST['email'];
$name = $_POST['name'];
//var_dump($_POST);
try {
    $entry = new Entry();
    $entry->setEmail($email);
    $entry->setName($name);
    $entry->setIpAddr($_SERVER['REMOTE_ADDR']);
    $em->persist($entry);
    $em->flush();
} catch (Exception $e) {
    die('{"status": 401, message: "Sorry, you have already entered once this round."}');
}
$query = $em->createQuery('SELECT COUNT(e.id) FROM Entry e');
$count = $query->getSingleScalarResult();
if ($count >= 3) {
    $prizes = $em->getRepository('Prize')->findBy(array('awarded' => false));
    $prize = $prizes[array_rand($prizes)];
    $prize->setAwarded(true);
    $offset = max(0, rand(0, 2));
    $query = $em->createQuery('SELECT DISTINCT e FROM Entry e')->setMaxResults(1)->setFirstResult($offset);
    $winningEntry = $query->getScalarResult()[0];
    $winner = new Winner();
    $winner->setEmail($winningEntry['e_email']);
    $winner->setName($winningEntry['e_name']);
    $winner->setIpAddr($winningEntry['e_ip_addr']);
    $winner->setPrize($prize);
开发者ID:scottstamp,项目名称:instawin,代码行数:31,代码来源:submit_entry.php

示例2: cloneEntry

 public function cloneEntry($sourceEntry, $targetEntry)
 {
     $criteria = $this->getCriteria()->select("idEntry, name, description, nick, idLanguage");
     $criteria->where("entry = '{$sourceEntry}'");
     $criteria->asQuery()->each(function ($row) use($targetEntry) {
         $entry = new Entry();
         $entry->setEntry($targetEntry);
         $entry->setName($row['name']);
         $entry->setDescription($row['description']);
         $entry->setNick($row['nick']);
         $entry->setIdLanguage($row['idLanguage']);
         $entry->save();
     });
 }
开发者ID:elymatos,项目名称:expressive_fnbr,代码行数:14,代码来源:EntryRepository.php


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