本文整理汇总了PHP中Tweet::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Tweet::delete方法的具体用法?PHP Tweet::delete怎么用?PHP Tweet::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tweet
的用法示例。
在下文中一共展示了Tweet::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($id)
{
try {
$tweet = new Tweet($id);
if (UserHelper::getProfileId() != $tweet->getProfileId() and !UserHelper::isEditor()) {
throw new fValidationException('not allowed');
}
$tweet->delete();
$this->ajaxReturn(array('result' => 'success'));
} catch (fException $e) {
$this->ajaxReturn(array('result' => 'failure', 'message' => $e->getMessage()));
}
}
示例2: testDeleteValidTweet
/**
* test creating a Tweet and then deleting it
**/
public function testDeleteValidTweet()
{
// count the number of rows and save it for later
$numRows = $this->getConnection()->getRowCount("tweet");
// create a new Tweet and insert to into mySQL
$tweet = new Tweet(null, $this->profile->getProfileId(), $this->VALID_TWEETCONTENT, $this->VALID_TWEETDATE);
$tweet->insert($this->getPDO());
// delete the Tweet from mySQL
$this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("tweet"));
$tweet->delete($this->getPDO());
// grab the data from mySQL and enforce the Tweet does not exist
$pdoTweet = Tweet::getTweetByTweetId($this->getPDO(), $tweet->getTweetId());
$this->assertNull($pdoTweet);
$this->assertEquals($numRows, $this->getConnection()->getRowCount("tweet"));
}
示例3: connectToEncryptedMySQL
<?php
require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
$pdo = connectToEncryptedMySQL("/etc/apache2/data-design/dmartinez337.ini");
$tweet = new Tweet(null, 1, "this is from PHP");
$tweet->insert($pdo);
$tweet->setTweetContent("now I changed the message");
$tweet->update($pdo);
$tweet->delete($pdo);