本文整理汇总了PHP中Tag::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::setId方法的具体用法?PHP Tag::setId怎么用?PHP Tag::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::setId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPut
public function testPut()
{
$tag = new Tag();
$tag->setId(50);
$tag->setTitle('test modifié');
$tagMapper = new TagMapper();
$tagMapper->setId(50);
$tagMapper->updateTag($tag);
$this->assertEquals($tag, $tagMapper->selectTag());
}
示例2: getTagByValue
/**
* Get tag by it's name/value.
*
* @param $value
* @return null|Tag
*/
public function getTagByValue($value)
{
$tag = new Tag();
$tag->setValue($value);
$query = $this->db->prepare("SELECT * FROM tags WHERE value = :value");
$query->bindValue(":value", $value);
$query->setFetchMode(PDO::FETCH_ASSOC);
$query->execute();
if ($row = $query->fetch()) {
$tag->setId($row['tag_id']);
} else {
return null;
}
return $tag;
}
示例3: setId
public function setId($id)
{
$this->label->setFor($id);
parent::setId($id);
}
示例4: listAssignedTags
/**
* Method for returning list of assigned tags or assigned to the
* specific person by ID.
* @param int $personId
* @return Tag[] Array of Tag objects
* @throws BadDatabaseQueryException
*/
public function listAssignedTags($personId = NULL)
{
$listOfAssignedTags;
if (!$personId) {
$strSQL = "SELECT * FROM tag";
} else {
$strSQL = "SELECT * FROM tag WHERE person_id=" . $personId;
}
if (!($result = $this->dbh->query($strSQL))) {
throw new BadDatabaseQueryException("Bad database query!");
}
while ($record = $result->fetch_array()) {
$newTag = new Tag();
$newTag->setId($record["id"]);
$newTag->setTagId($record["tagid"]);
$newTag->setMAC($record["mac"]);
$listOfAssignedTags[] = $newTag;
}
return $listOfAssignedTags;
}
示例5: create
public function create(Tag &$Tag)
{
$this->db->query("insert into Tag set\n \tname='" . $this->db->escape($Tag->getName()) . "',\n description='" . $this->db->escape($Tag->getDescription()) . "'");
# Set the newly assigned id
$Tag->setId($this->db->getLastInsertedId());
}