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


PHP Post::setSummary方法代码示例

本文整理汇总了PHP中AppBundle\Entity\Post::setSummary方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::setSummary方法的具体用法?PHP Post::setSummary怎么用?PHP Post::setSummary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AppBundle\Entity\Post的用法示例。


在下文中一共展示了Post::setSummary方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadPosts

 private function loadPosts(ObjectManager $manager)
 {
     $category = new Category();
     $category->setName('Improvements');
     foreach (range(1, 5) as $i) {
         $post = new Post();
         $post->setTitle($this->getRandomPostTitle());
         $post->setSummary($this->getRandomPostSummary());
         $post->setSlug($this->container->get('slugger')->slugify($post->getTitle()));
         $post->setContent($this->getPostContent());
         $post->setAuthorEmail('a.martynenko@levi9.com');
         $post->setPublishedAt(new \DateTime('now - ' . $i . 'days'));
         $post->setState($this->getRandomState());
         $post->setCategory($category);
         foreach (range(1, 5) as $j) {
             $comment = new Comment();
             $comment->setAuthorEmail('d.kiprushev@levi9.com');
             $comment->setPublishedAt(new \DateTime('now + ' . ($i + $j) . 'seconds'));
             $comment->setContent($this->getRandomCommentContent());
             $comment->setPost($post);
             $manager->persist($comment);
             $post->addComment($comment);
         }
         if (rand(0, 1)) {
             $vote = new Vote();
             $vote->setAuthorEmail(rand(0, 1) ? 'a.martynenko@levi9.com' : 'd.kiprushev@levi9.com');
             $vote->setPost($post);
             $vote->setVote(rand(0, 1));
         }
         $manager->persist($post);
         $category->addPost($post);
     }
     $manager->flush();
 }
开发者ID:panayotovyura,项目名称:levi9voter,代码行数:34,代码来源:LoadFixtures.php

示例2: testRabbitMQ

 public function testRabbitMQ()
 {
     $client = static::createClient();
     $post = new Post();
     $post->setTitle('Lorem ipsum dolor');
     $post->setSlug('Lorem-ipsum-dolor');
     $post->setSummary('Lorem ipsum dolor sit amet consectetur adipiscing elit Urna nisl sollicitudin');
     $post->setContent('Lorem ipsum dolor sit amet consectetur adipiscing elit Urna nisl sollicitudin');
     $post->setAuthorEmail('anna_admin@symfony.com');
     $this->entityManager->persist($post);
     $this->entityManager->flush();
     $client->request('POST', '/post/generate_pdf/' . $post->getId());
     $this->assertEquals(Response::HTTP_OK, $client->getResponse()->getStatusCode());
     $pdfName = json_decode($client->getResponse()->getContent(), true)['pdfName'];
     $this->entityManager->remove($post);
     $this->entityManager->flush();
     $pdfPath = self::$kernel->getRootDir() . '/../web/downloads/pdf/' . $pdfName . '.pdf';
     sleep(2);
     $this->assertTrue(file_exists($pdfPath));
     unlink($pdfPath);
 }
开发者ID:alfonsomga,项目名称:symfony.demo.on.roids,代码行数:21,代码来源:RabbitMQControllerTest.php

示例3: testElasticSearch

 public function testElasticSearch()
 {
     $client = self::createClient();
     $crawler = $client->request('GET', '/blog/search-results?q=odio');
     $this->assertEquals(Response::HTTP_OK, $client->getResponse()->getStatusCode());
     $this->assertEquals('Results for <b>odio</b> (5)', $crawler->filter('h2#results-info>span')->html());
     $randnumber = rand();
     $post = new Post();
     $post->setTitle('Elasticsearch rocks ' . $randnumber);
     $post->setSlug('elasticsearch-rocks-' . $randnumber);
     $post->setSummary('Lorem ipsum dolor sit amet consectetur adipiscing elit Urna nisl sollicitudin');
     $post->setContent('Lorem ipsum dolor sit amet consectetur adipiscing elit Urna nisl sollicitudin');
     $post->setAuthorEmail('anna_admin@symfony.com');
     $this->entityManager->persist($post);
     $this->entityManager->flush();
     self::populateElasticSearchIndices();
     $crawler = $client->request('GET', '/blog/search-results?q=Elasticsearch rocks ' . $randnumber);
     $this->assertEquals(Response::HTTP_OK, $client->getResponse()->getStatusCode());
     $this->assertEquals('Results for <b>Elasticsearch rocks ' . $randnumber . '</b> (1)', $crawler->filter('h2#results-info>span')->html());
     $this->entityManager->remove($post);
     $this->entityManager->flush();
 }
开发者ID:alfonsomga,项目名称:symfony.demo.on.roids,代码行数:22,代码来源:ElasticSearchControllerTest.php

示例4: loadPosts

 private function loadPosts(ObjectManager $manager)
 {
     foreach (range(1, 10) as $i) {
         $post = new Post();
         $post->setTitle($this->getRandomPostTitle());
         $post->setSummary($this->getRandomPostSummary());
         $post->setSlug($this->container->get('slugger')->slugify($post->getTitle()));
         $post->setContent($this->getPostContent());
         $post->setAuthorEmail('anna_admin@symfony.com');
         $post->setPublishedAt(new \DateTime('now - ' . $i . 'days'));
         foreach (range(1, 5) as $j) {
             $comment = new Comment();
             $comment->setAuthorEmail('john_user@symfony.com');
             $comment->setPublishedAt(new \DateTime('now + ' . ($i + $j) . 'seconds'));
             $comment->setContent($this->getRandomCommentContent());
             $comment->setPost($post);
             $manager->persist($comment);
             $post->addComment($comment);
         }
         $manager->persist($post);
     }
     $manager->flush();
 }
开发者ID:Arakaki,项目名称:symfony-demo,代码行数:23,代码来源:LoadFixtures.php

示例5: getExamplePostEntity

 public function getExamplePostEntity()
 {
     $post = new Post();
     $post->setTitle('Eros diam egestas libero eu vulputate risus');
     $post->setSlug('eros-diam-egestas-libero-eu-vulputate-risus');
     $post->setSummary('Sed varius a risus eget aliquam Pellentesque et sapien pulvinar consectetur In
         hac habitasse platea dictumst Urna nisl sollicitudin id varius orci quam id turpis Ut eleifend mauris
         et risus ultrices egestas Aliquam sodales odio id eleifend tristique Ut suscipit posuere justo at
         vulputate');
     $post->setContent('Lorem ipsum dolor sit amet consectetur adipisicing elit, sed do eiusmod tempor
         incididunt ut labore et **dolore magna aliqua**: Duis aute irure dolor in
         reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
         Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
         deserunt mollit anim id est laborum.');
     $post->setAuthorEmail('anna_admin@symfony.com');
     $this->entityManager->persist($post);
     $this->entityManager->flush();
     return $post;
 }
开发者ID:alfonsomga,项目名称:symfony.demo.on.roids,代码行数:19,代码来源:RestControllerTest.php

示例6: load

 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $post = new Post();
     $post->setTitle('Cras dignissim vestibulum ultrices');
     $post->setSummary($this->getPostSummary());
     $post->setContent($this->getPostContent());
     $post->setAuthor($this->getReference('user-john_admin'));
     $post->setCategory($this->getReference('category-Vestibulum'));
     $post->addTag($this->getReference('tag-volutpat'));
     $post->addTag($this->getReference('tag-enim'));
     $post->addTag($this->getReference('tag-bibendum'));
     $manager->persist($post);
     $this->setReference('post-1', $post);
     $post = new Post();
     $post->setTitle('Neque porro quisquam est qui dolorem');
     $post->setSummary($this->getPostSummary());
     $post->setContent($this->getPostContent());
     $post->setAuthor($this->getReference('user-john_admin'));
     $post->setCategory($this->getReference('category-Dolorem'));
     $post->addTag($this->getReference('tag-uspendisse'));
     $post->addTag($this->getReference('tag-imperdiet'));
     $post->addTag($this->getReference('tag-ullamcorper'));
     $manager->persist($post);
     $this->setReference('post-2', $post);
     $post = new Post();
     $post->setTitle('Ut enim ad minim veniam, quis nostrud');
     $post->setSummary($this->getPostSummary());
     $post->setContent($this->getPostContent());
     $post->setAuthor($this->getReference('user-john_admin'));
     $post->setCategory($this->getReference('category-Nostrud'));
     $post->addTag($this->getReference('tag-lacus'));
     $post->addTag($this->getReference('tag-aliquam'));
     $post->addTag($this->getReference('tag-eumassa'));
     $manager->persist($post);
     $this->setReference('post-3', $post);
     $post = new Post();
     $post->setTitle('Duis aute irure dolor in reprehenderit');
     $post->setSummary($this->getPostSummary());
     $post->setContent($this->getPostContent());
     $post->setAuthor($this->getReference('user-john_admin'));
     $post->setCategory($this->getReference('category-Reprehenderit'));
     $post->addTag($this->getReference('tag-utnunc'));
     $post->addTag($this->getReference('tag-gravida'));
     $post->addTag($this->getReference('tag-ullamcorper'));
     $manager->persist($post);
     $this->setReference('post-4', $post);
     $post = new Post();
     $post->setTitle('Excepteur sint occaecat cupidatat proident');
     $post->setSummary($this->getPostSummary());
     $post->setContent($this->getPostContent());
     $post->setAuthor($this->getReference('user-john_admin'));
     $post->setCategory($this->getReference('category-Dolorem'));
     $post->addTag($this->getReference('tag-uspendisse'));
     $post->addTag($this->getReference('tag-maecenas'));
     $post->addTag($this->getReference('tag-justo'));
     $manager->persist($post);
     $this->setReference('post-5', $post);
     $post = new Post();
     $post->setTitle('Aenean eget lobortis lectus');
     $post->setSummary($this->getPostSummary());
     $post->setContent($this->getPostContent());
     $post->setAuthor($this->getReference('user-john_admin'));
     $post->setCategory($this->getReference('category-Dolorem'));
     $post->addTag($this->getReference('tag-consectetur'));
     $post->addTag($this->getReference('tag-imperdiet'));
     $post->addTag($this->getReference('tag-facilisis'));
     $manager->persist($post);
     $this->setReference('post-6', $post);
     $manager->flush();
 }
开发者ID:sandraf,项目名称:symfony2-project,代码行数:73,代码来源:LoadPostData.php


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