Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. public function actionTest()
  2.     {
  3.         $contents = Content::findAll(['type'=>Content::TYPE_SPIN]);
  4.         foreach ($contents as $content) {
  5.             $re = '/([^\/]+$)/m';
  6.             preg_match($re, $content->aws_s3_object, $matches);
  7.             if(!empty($matches[0])){
  8.                 $videoModel = ContentHelper::getVideoBySpin($content);
  9.                 if($videoModel){
  10.                     $contentVideo = Content::find()->where(['aws_s3_object'=>$videoModel->aws_s3_object])->andWhere(['type'=>Content::TYPE_VIDEO])->one();
  11.                     if($contentVideo){
  12.                         $contentBinding = new ContentBindings();
  13.                         $contentBinding->parent_id = $content->id;
  14.                         $contentBinding->child_id = $contentVideo->id;
  15.                         $contentBinding->save();
  16.                     }
  17.                 }
  18.  
  19.  
  20.             }
  21.         }
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement