Sulu\Bundle\TagBundle\Entity\Tag::setCreator PHP Method

setCreator() public method

Set creator.
public setCreator ( Sulu\Component\Security\Authentication\UserInterface $creator = null ) : Tag
$creator Sulu\Component\Security\Authentication\UserInterface
return Tag
    public function setCreator(\Sulu\Component\Security\Authentication\UserInterface $creator = null)
    {
        $this->creator = $creator;
        return $this;
    }

Usage Example

 public function setUp()
 {
     parent::setUp();
     $this->purgeDatabase();
     $this->initPhpcr();
     $this->mapper = $this->getContainer()->get('sulu.content.mapper');
     $this->structureManager = $this->getContainer()->get('sulu.content.structure_manager');
     $this->webspaceManager = $this->getContainer()->get('sulu_core.webspace.webspace_manager');
     $this->sessionManager = $this->getContainer()->get('sulu.phpcr.session');
     $this->contentQuery = $this->getContainer()->get('sulu.content.query_executor');
     $this->languageNamespace = $this->getContainer()->getParameter('sulu.content.language.namespace');
     $em = $this->getContainer()->get('doctrine')->getManager();
     $user = $em->getRepository('Sulu\\Bundle\\SecurityBundle\\Entity\\User')->findOneByUsername('test');
     $this->tag1 = new Tag();
     $this->tag1->setName('test1');
     $this->tag1->setCreator($user);
     $this->tag1->setChanger($user);
     $em->persist($this->tag1);
     $this->tag2 = new Tag();
     $this->tag2->setName('test2');
     $this->tag2->setCreator($user);
     $this->tag2->setChanger($user);
     $em->persist($this->tag2);
     $this->tag3 = new Tag();
     $this->tag3->setName('test3');
     $this->tag3->setCreator($user);
     $this->tag3->setChanger($user);
     $em->persist($this->tag3);
     $em->flush();
 }
All Usage Examples Of Sulu\Bundle\TagBundle\Entity\Tag::setCreator