setCreator() public méthode

Set creator.
public setCreator ( Sulu\Component\Security\Authentication\UserInterface $creator = null ) : FileVersion
$creator Sulu\Component\Security\Authentication\UserInterface
Résultat FileVersion
Exemple #1
0
 /**
  * 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;
 }