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


PHP Posts::getClassName方法代码示例

本文整理汇总了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');
     //		}
 }
开发者ID:regiss,项目名称:doctrine-sand,代码行数:33,代码来源:Blog.php

示例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);
 }
开发者ID:rutrader,项目名称:nette-blog,代码行数:20,代码来源:PostPresenter.php


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