SHARE
TWEET

Untitled

a guest Jan 27th, 2020 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.                 $content_video = Content::find()->where(['like','aws_s3_object','%'.$matches[0].'%',false])->andWhere(['type'=>Content::TYPE_VIDEO])->one();
  9.                 if($content_video){
  10.                     $contentBinding = new ContentBindings();
  11.                     $contentBinding->parent_id = $content->id;
  12.                     $contentBinding->child_id = $content_video->id;
  13.                     $contentBinding->save();
  14.                 }
  15.  
  16.             }
  17.         }
  18.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top