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


PHP Post::addTag方法代码示例

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


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

示例1: 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

示例2: addTag

 /**
  * {@inheritDoc}
  */
 public function addTag(\AppBundle\Entity\Tag $tag)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'addTag', [$tag]);
     return parent::addTag($tag);
 }
开发者ID:DenisRupp,项目名称:SymfonyBlogHW7,代码行数:8,代码来源:__CG__AppBundleEntityPost.php


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