setChanger() public method

public setChanger ( Sulu\Component\Security\Authentication\UserInterface $changer = null )
$changer Sulu\Component\Security\Authentication\UserInterface
Example #1
0
 /**
  * Creates a new category with given data.
  *
  * @param $data
  * @param $user
  *
  * @return CategoryEntity
  */
 private function createCategory($data, $user)
 {
     $categoryEntity = new CategoryEntity();
     $categoryEntity->setCreator($user);
     $categoryEntity->setChanger($user);
     $categoryWrapper = $this->getApiObject($categoryEntity, $data['locale']);
     $categoryWrapper->setName($data['name']);
     if (array_key_exists('key', $data)) {
         $categoryWrapper->setKey($data['key']);
     }
     if (array_key_exists('meta', $data)) {
         $categoryWrapper->setMeta($data['meta']);
     }
     if (array_key_exists('parent', $data)) {
         $parentEntity = $this->findById($data['parent']);
         $categoryWrapper->setParent($parentEntity);
     }
     $categoryEntity = $categoryWrapper->getEntity();
     $this->em->persist($categoryEntity);
     $this->em->flush();
     return $categoryEntity;
 }