plugin/video-player/Serializer/TrackSerializer.php
public function deserialize($data, Track $track)
    {
        if (empty($track)) {
            $track = new Track();
        }
        $track->setUuid($data['id']);
        $video = $this->fileRepo->findOneBy(['id' => $data['video']['id']]);
        $track->setVideo($video);
        $this->sipe('meta.label', 'setLabel', $data, $track);
        $this->sipe('meta.lang', 'setLang', $data, $track);
        $this->sipe('meta.kind', 'setKind', $data, $track);
        $this->sipe('meta.default', 'setIsDefault', $data, $track);

        if (isset($data['file'])) {
            $trackFile = $this->fileManager->create(
                new File(),
                $data['file'],
                $data['file']->getClientOriginalName(),
                $data['file']->getMimeType(),
                $video->getResourceNode()->getWorkspace()
            );
            $this->om->persist($trackFile);
            $track->setTrackFile($trackFile);
        }

        return $track;
    }
public function deserialize($data, Track $track)
    {
        if (empty($track)) {
            $track = new Track();
        }
        $track->setUuid($data['id']);
        $video = $this->fileRepo->findOneBy(['id' => $data['video']['id']]);
        $track->setVideo($video);
        $this->sipe('meta.label', 'setLabel', $data, $track);
        $this->sipe('meta.lang', 'setLang', $data, $track);
        $this->sipe('meta.kind', 'setKind', $data, $track);
        $this->sipe('meta.default', 'setIsDefault', $data, $track);

        if (isset($data['file'])) {
            $trackFile = $this->fileManager->create(
                new File(),
                $data['file'],
                $data['file']->getClientOriginalName(),
                $data['file']->getMimeType(),
                $video->getResourceNode()->getWorkspace()
            );
            $this->om->persist($trackFile);
            $track->setTrackFile($trackFile);
        }

        return $track;
    }
public function deserialize ( $ data , Track $ track ) { if ( empty ( $ track ) ) { $ track = new Track ( ) ; } $ track -> setUuid ( $ data [ 'id' ] ) ; $ video = $ this -> fileRepo -> findOneBy ( [ 'id' => $ data [ 'video' ] [ 'id' ] ] ) ; $ track -> setVideo ( $ video ) ; $ this -> sipe ( 'meta.label' , 'setLabel' , $ data , $ track ) ; $ this -> sipe ( 'meta.lang' , 'setLang' , $ data , $ track ) ; $ this -> sipe ( 'meta.kind' , 'setKind' , $ data , $ track ) ; $ this -> sipe ( 'meta.default' , 'setIsDefault' , $ data , $ track ) ; if ( isset ( $ data [ 'file' ] ) ) { $ trackFile = $ this -> fileManager -> create ( new File ( ) , $ data [ 'file' ] , $ data [ 'file' ] -> getClientOriginalName ( ) , $ data [ 'file' ] -> getMimeType ( ) , $ video -> getResourceNode ( ) -> getWorkspace ( ) ) ; $ this -> om -> persist ( $ trackFile ) ; $ track -> setTrackFile ( $ trackFile ) ; } return $ track ; }
Deserializes data into a Track entity.

@param \stdClass $data
@param Track     $track

@return Track
Deserializes data into a Track entity .