Advertisement
Guest User

Untitled

a guest
Jul 20th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. public static function getHtmlLink(EntityManagerInterface $em)
  2.     {
  3.         $repository = $em->getRepository(static::class);
  4.         $videos = $repository->findAll();
  5.  
  6.         $basicLinks = [];
  7.  
  8.         foreach ($videos as $video) {
  9.             $basicLinks[] = $video->getLink();
  10.         }
  11.         $parts = [];
  12.         foreach ($basicLinks as $link) {
  13.             $parts[] = explode('=', $link);
  14.         }
  15.  
  16.         $linksId = [];
  17.         foreach ($parts as $value) {
  18.             $linksId[] = $value[1];
  19.         }
  20.  
  21.         $htmlLinks = [];
  22.         foreach ($linksId as $value) {
  23.             $htmlLinks[] = 'https://www.youtube.com/embed/' . $value .'?ecver=2';
  24.         }
  25.  
  26.         return $htmlLinks;
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement