示例#1
0
 /**
  * Create, not persist, tag given its name
  *
  * @param  String     $name
  * @return TagManager the generated Tag
  */
 public function createTag($name)
 {
     $tag = new Tag();
     $tag->setName($name);
     return $tag;
 }
示例#2
0
 /**
  * This method is used by the workspace import function.
  *
  * @param string $name
  *
  * @return Tag
  */
 protected function retrieveTag($name)
 {
     $tag = $this->objectManager->getRepository('IcapBlogBundle:Tag')->findOneByName($name);
     if (!$tag) {
         //let's look if it's scheduled for an Insert...
         $tag = $this->getTagFromIdentityMapOrScheduledForInsert($name);
         if (!$tag) {
             $tag = new Tag();
             $tag->setName($name);
             $this->objectManager->persist($tag);
         }
     }
     return $tag;
 }
示例#3
0
 /**
  * @param string $name
  *
  * @return Tag
  */
 protected function retrieveTag($name)
 {
     $tag = $this->objectManager->getRepository('IcapBlogBundle:Tag')->findOneByName($name);
     if (null === $tag) {
         $tag = new Tag();
         $tag->setName($name);
     }
     return $tag;
 }