setChanger() public method

Set changer.
public setChanger ( Sulu\Component\Security\Authentication\UserInterface $changer = null ) : FileVersion
$changer Sulu\Component\Security\Authentication\UserInterface
return FileVersion
コード例 #1
0
ファイル: MediaManager.php プロジェクト: gitter-badger/sulu
 /**
  * Create a new media.
  *
  * @param $data
  * @param $user
  *
  * @return Media
  */
 protected function createMedia($data, $user)
 {
     $mediaEntity = new MediaEntity();
     $mediaEntity->setCreator($user);
     $mediaEntity->setChanger($user);
     $file = new File();
     $file->setCreator($user);
     $file->setChanger($user);
     $file->setVersion(1);
     $file->setMedia($mediaEntity);
     $fileVersion = new FileVersion();
     $fileVersion->setCreator($user);
     $fileVersion->setChanger($user);
     $fileVersion->setVersion(1);
     $fileVersion->setFile($file);
     $file->addFileVersion($fileVersion);
     $mediaEntity->addFile($file);
     $media = new Media($mediaEntity, $data['locale'], null);
     $media = $this->setDataToMedia($media, $data, $user);
     $fileVersion->setDefaultMeta($fileVersion->getMeta()->first());
     $mediaEntity = $media->getEntity();
     $this->em->persist($mediaEntity);
     $this->em->flush();
     return $media;
 }