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])){
- $videoModel = ContentHelper::getVideoBySpin($content);
- if($videoModel){
- $contentVideo = Content::find()->where(['aws_s3_object'=>$videoModel->aws_s3_object])->andWhere(['type'=>Content::TYPE_VIDEO])->one();
- if($contentVideo){
- $contentBinding = new ContentBindings();
- $contentBinding->parent_id = $content->id;
- $contentBinding->child_id = $contentVideo->id;
- $contentBinding->save();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement