本文整理汇总了PHP中app\Posts::getClassName方法的典型用法代码示例。如果您正苦于以下问题:PHP Posts::getClassName方法的具体用法?PHP Posts::getClassName怎么用?PHP Posts::getClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Posts
的用法示例。
在下文中一共展示了Posts::getClassName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderDefault
public function renderDefault()
{
$this->template->anyVariable = 'any value';
// $dao = $this->articles;
$this->template->articles = $this->articles->getArticles()->findAll();
$posts = $this->EntityManager->getRepository(Posts::getClassName());
$this->template->posts = $posts->findAll();
$this->template->myparametr = $this->context->parameters['first_parametr'];
// $this->template->test = $this->doSomeRefactoring('Hello world from blog');
// $post = new Posts();
// $post->title = 'New title';
// $post->text = 'New text New textNew text';
// $post->created_at = new \Nette\Utils\DateTime;
//
//
// $this->EntityManager->persist($post);
// $this->EntityManager->flush();
// $dao = $this->EntityManager->getRepository(Posts::getClassName());
// $dao->setTitle('test');
// $dao->__call('set', ['title' => 'my title']);
// dump($dao->__isset('title'));
// $dao->__set('title', 'test');
try {
$this->checkNum(2);
\Tracy\Debugger::barDump('If you see this, the number is 1 or below');
} catch (Nette\Application\BadRequestException $e) {
Debugger::log('Message: ' . $e->getMessage());
var_dump($e->getMessage());
}
// finally {
// \Tracy\Debugger::barDump('Got here Finally');
// }
}
示例2: actionSave
public function actionSave()
{
$repo = $this->em->getRepository(Posts::getClassName());
$oPost = $repo->find($this->request->getPost('id'));
if (is_null($oPost)) {
$oPost = new Posts();
}
$oPost->title = $this->request->getPost('title');
$oPost->content = $this->request->getPost('content');
$oPost->intro = strip_tags($this->request->getPost('intro'));
$oPost->createdAt = $this->request->getPost('created_at') . " 00:00:00";
$postCover = $this->savePostCover();
if ($postCover) {
$oPost->postCover = $postCover;
}
$this->em->persist($oPost);
$this->em->flush();
$this->flashMessage('Thank you for your comment', 'success');
$this->redirectUrl('/#/post/' . $oPost->id);
}