Пример #1
0
 /**
  * @param MediaManager $mediaManager
  * @param String       $type
  *
  * @return \Symfony\Component\Form\FormView
  */
 private function createTypeFormView(MediaManager $mediaManager, $type)
 {
     $handler = $mediaManager->getHandlerForType($type);
     $media = new Media();
     $helper = $handler->getFormHelper($media);
     return $this->createForm($handler->getFormType(), $helper)->createView();
 }
Пример #2
0
 /**
  * @param object $entity The entity
  * @param bool   $new    Is new
  */
 private function saveMedia($entity, $new = false)
 {
     if (!$entity instanceof Media) {
         return;
     }
     $this->mediaManager->saveMedia($entity, $new);
 }