/**
  * @Template("PumukitNewAdminBundle:Material:list.html.twig")
  */
 public function listAction(MultimediaObject $multimediaObject)
 {
     return array('mmId' => $multimediaObject->getId(), 'materials' => $multimediaObject->getMaterials());
 }
 public function testMaterialsInMultimediaObject()
 {
     $mm = new MultimediaObject();
     $material1 = new Material();
     $material2 = new Material();
     $material3 = new Material();
     $this->assertEquals(0, count($mm->getMaterials()));
     $mm->addMaterial($material1);
     $mm->addMaterial($material2);
     $mm->addMaterial($material3);
     $this->assertEquals(3, count($mm->getMaterials()));
     $materialsArray = array($material1, $material2, $material3);
     $this->assertEquals($materialsArray, $mm->getMaterials()->toArray());
     $mm->removeMaterial($material2);
     $this->assertEquals(2, count($mm->getMaterials()));
     $this->assertTrue($mm->containsMaterial($material1));
     $this->assertFalse($mm->containsMaterial($material2));
     $materialsArray = array(0 => $material1, 2 => $material3);
     $this->assertEquals($materialsArray, $mm->getMaterials()->toArray());
 }
 /**
  * Get VTT captions
  *
  * @param MultimediaObject $multimediaObjet
  * @return array
  */
 public function getCaptions(MultimediaObject $multimediaObject)
 {
     $mimeTypeCaptions = self::MIME_TYPE_CAPTIONS;
     return $multimediaObject->getMaterials()->filter(function ($material) use($mimeTypeCaptions) {
         return $material->getMimeType() === $mimeTypeCaptions;
     });
 }