本文整理汇总了PHP中CommentModel::find方法的典型用法代码示例。如果您正苦于以下问题:PHP CommentModel::find方法的具体用法?PHP CommentModel::find怎么用?PHP CommentModel::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommentModel
的用法示例。
在下文中一共展示了CommentModel::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDeleteAll
public function testDeleteAll()
{
$userTable = new UserModel();
$commentTable = new CommentModel();
$moodTable = new MoodListModel();
$userTable->deleteAll();
$comment = $commentTable->find();
$mood = $moodTable->find();
$user = $userTable->find();
$this->assertTrue($comment == null && $user == null && $mood == null);
}
示例2: validateInput
} else {
$movieId = validateInput($_POST['movieId']);
$comment = validateInput($_POST['comment']);
if (array_key_exists('commentId', $_POST)) {
$commentId = $_POST['commentId'];
}
}
} else {
throw new Exception("Error Processing Request", 1);
}
// Check if database is available
CheckOrCreateDB();
if (!$delete) {
// populating the data
$co = new CommentModel(array('movie_id' => $movieId, 'comment' => $comment, 'id' => $commentId));
$co->save();
$response = array('id' => $co->id, 'message' => 'success!!');
} else {
if ($delete) {
// Actions for delete
$co = CommentModel::find($commentId);
if ($co->delete()) {
$response = array('message' => 'success');
} else {
$response = array('message' => 'some problems');
}
}
}
$encoded = json_encode($response);
header('Content-type: application/json');
exit($encoded);