Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function actionTest()
- {
- $contents = Content::findAll(['type'=>Content::TYPE_SPIN]);
- foreach ($contents as $content) {
- $re = '/([^\/]+$)/m';
- preg_match($re, $content->aws_s3_object, $matches);
- if(!empty($matches[0])){
- $content_video = Content::find()->where(['like','aws_s3_object','%'.$matches[0].'%',false])->andWhere(['type'=>Content::TYPE_VIDEO])->one();
- if($content_video){
- $contentBinding = new ContentBindings();
- $contentBinding->parent_id = $content->id;
- $contentBinding->child_id = $content_video->id;
- $contentBinding->save();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement