Deserializes data into a Track entity.

@param \stdClass $data
@param Track     $track

@return Track
553039
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;
    }
345103
public function copyTrack($oldTrackId)
    {
        $trackModel = $this->tracker->getTrackModel();

        $roundModel = $this->getRoundModel(true, 'rounds');
        $fieldModel = $this->getFieldsMaintenanceModel();

        // First load the track
        $trackModel->applyParameters(array('id' => $oldTrackId));
        $track = $trackModel->loadFirst();

        // Create an empty track
        $newTrack = $trackModel->loadNew();
        unset($track['gtr_id_track'], $track['gtr_changed'], $track['gtr_changed_by'], $track['gtr_created'], $track['gtr_created_by']);
        $track['gtr_track_name'] .= $this->_(' - Copy');
        $newTrack = $track + $newTrack;
        // Now save (not done yet)
        $savedValues = $trackModel->save($newTrack);
        $newTrackId = $savedValues['gtr_id_track'];

        // Now copy the fields
        $fieldModel->applyParameters(array('id' => $oldTrackId));
        $fields = $fieldModel->load();

        if ($fields) {
            $oldIds = array();
            $numFields = count($fields);
            $newFields = $fieldModel->loadNew($numFields);
            foreach ($newFields as $idx => $newField) {
                $field = $fields[$idx];
                $oldIds[$idx] = $field['gtf_id_field'];
                unset($field['gtf_id_field'], $field['gtf_changed'], $field['gtf_changed_by'], $field['gtf_created'], $field['gtf_created_by']);
                $field['gtf_id_track'] = $newTrackId;
                $newFields[$idx] = $field + $newFields[$idx];
            }
            // Now save (not done yet)
            $savedValues = $fieldModel->saveAll($newFields);
            foreach($savedValues as $idx => $field) {
                $oldNewFieldMap[$oldIds[$idx]] = $field['gtf_id_field'];
            }
        } else {
            $numFields = 0;
        }

        // Now copy the rounds and map the gro_id_relation to the right field
        $roundModel->applyParameters(array('id' => $oldTrackId));
        $rounds = $roundModel->load();

        if ($rounds) {
            $numRounds = count($rounds);
            $newRounds = $roundModel->loadNew($numRounds);
            foreach ($newRounds as $idx => $newRound) {
                $round = $rounds[$idx];
                unset($round['gro_id_round'], $round['gro_changed'], $round['gro_changed_by'], $round['gro_created'], $round['gro_created_by']);
                $round['gro_id_track'] = $newTrackId;
                if (array_key_exists('gro_id_relationfield', $round) && $round['gro_id_relationfield']>0) {
                    $round['gro_id_relationfield'] = $oldNewFieldMap[$round['gro_id_relationfield']];
                }
                $newRounds[$idx] = $round + $newRounds[$idx];
            }
            // Now save (not done yet)
            $savedValues = $roundModel->saveAll($newRounds);
        } else {
            $numRounds = 0;
        }

        //MUtil_Echo::track($track, $copy);
        //MUtil_Echo::track($rounds, $newRounds);
        //MUtil_Echo::track($fields, $newFields);
        Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger')->addMessage(sprintf($this->_('Copied track, including %s round(s) and %s field(s).'), $numRounds, $numFields));

        return $newTrackId;
    }
119202
protected function getLabelFromRecordData(array $data)
    {
        $label = Arrays::getValueByPath($data, $this->labelDataKey);
        if ($label === null) {
            throw new \Exception('Could not determine label from record data (key: ' . $this->labelDataKey . '). See ' . self::class . ' for more information.', 1462968958372);
        }
        return (string)$label;
    }
913004
public static function createFromXml(XmlElement $xml, ControllerInterface $controller): TrackInterface
    {
        $track = parent::createFromXml($xml, $controller);

        return $track;
    }
993212
public function deserialize($data, Text $text)
    {
        $user = $this->tokenStorage->getToken()->getUser();

        if (isset($data['content'])) {
            $revision = new Revision();
            $revision->setContent($data['content']);
            $revision->setUser('anon.' === $user ? null : $user);
            $revision->setText($text);
            $version = $text->getVersion() + 1;
            $revision->setVersion($version);
            $text->setVersion($version);
        }

        return $text;
    }
1143044
public function setDataObject($data)
    {
        if (true === is_object($data)) {
            $data = json_encode($data);
        }

        return $this->setData($data);
    }
800507
private function parseConnectionData(\stdClass $initData)
    {
        $return = new \stdClass;
        $return->host = isset($initData->host) ? $initData->host : self::DEFAULT_HOST;
        $return->port = isset($initData->port) ? $initData->port : null;
        $return->timeout = isset($initData->timeoutInSeconds) ? $initData->timeoutInSeconds : null;

        return $return;
    }
465031
public static function allow_track() {
        $DoNotTrackHeader = "DNT";
        $DoNotTrackValue = "1";

        $phpHeader = "HTTP_" . strtoupper(str_replace("-", "_", $DoNotTrackHeader));

        $retval = ! ((array_key_exists($phpHeader, $_SERVER)) and ($_SERVER[$phpHeader] == $DoNotTrackValue));
        return $retval;
    }
839403
public function execute($trackId = null)
    {
        $batch = $this->getBatch();
        $select = $this->db->select();

        // Join conditions on rounds, handle and / or conditions when implemented
        $select->from('gems__conditions', array(
            'gcon_id', 'gcon_type', 'gcon_class', 'gcon_name', 'gcon_condition_text1', 'gcon_condition_text2', 'gcon_condition_text3', 'gcon_condition_text4',
            ))  ->joinInner('gems__rounds', 'gems__conditions.gcon_id = gems__rounds.gro_condition', array())
                ->where('gems__rounds.gro_id_track = ?', $trackId)
                ->distinct(true);
        // \MUtil_Echo::track($select->__toString(), $roundId);

        $data = $this->db->fetchAll($select);
        // \MUtil_Echo::track($data);

        if ($data) {
            $this->exportTypeHeader('conditions');
            $this->exportFieldHeaders(reset($data));
            
            foreach($data as $row)
            {
                $this->exportFieldData($row);
                $count = $batch->addToCounter('conditions_exported');
            }
            $this->exportFlush();

            $batch->setMessage('conditions_export', sprintf(
                    $this->plural('%d condition exported', '%d conditions exported', $count),
                    $count
                    ));
        }
    }
1313168
public function from_data_to_event_properties(\stdClass $data) {
        $properties = clone($data);

        if ($data->eventtype == 'group') {
            if (isset($data->groupcourseid)) {
                $properties->courseid = $data->groupcourseid;
                unset($properties->groupcourseid);
            }
            if (isset($data->groupid)) {
                $properties->groupid = $data->groupid;
            }
        } else {
            // Default course id if none is set.
            if (empty($properties->courseid)) {
                if ($properties->eventtype == 'site') {
                    $properties->courseid = SITEID;
                } else {
                    $properties->courseid = 0;
                }
            } else {
                $properties->courseid = $data->courseid;
            }
        }

        // Decode the form fields back into valid event property.
        $properties->timeduration = $this->get_time_duration_from_form_data($data);

        return $properties;
    }
123941
public function deserialize(array $data, Theme $theme = null)
    {
        $theme = $theme ?: new Theme();

        $theme->setName($data['name']);

        // todo : update other themes props

        return $theme;
    }
1334136
public function deserialize($class, $data)
    {
        $document = $this->documentRepo->findOneBy(['uuid' => $data['id']]);

        if (empty($document)) {
            $document = new Document();
            $document->setUuid($data['id']);

            /** @var Drop $drop */
            $drop = $this->dropRepo->findOneBy(['uuid' => $data['drop']]);
            $document->setDrop($drop);
            $currentUser = $this->tokenStorage->getToken()->getUser();

            if ($currentUser instanceof User) {
                $document->setUser($currentUser);
            }
            $document->setDropDate(new \DateTime());
        }
        if (isset($data['type'])) {
            $document->setType($data['type']);

            if (isset($data['data'])) {
                $documentData = Document::DOCUMENT_TYPE_RESOURCE === $document->getType() ?
                    $this->resourceNodeRepo->findOneBy(['uuid' => $data['data']]) :
                    $data['data'];
                $document->setData($documentData);
            }
        }

        return $document;
    }
1234096
public function deserialize($data, Lesson $lesson = null)
    {
        if (empty($lesson)) {
            $lesson = new lesson();
        }

        return $lesson;
    }
149434
public function hydrate(array $data, $object)
    {
        if (!isset($data['tracks'])) {
            return $object;
        }

        $object->setTracks(new Tracks($data['tracks']));

        return $object;
    }
1138667
public function save_post_track_changed_fields( $data, $postarr ) {

		$no_conflict = pods_no_conflict_check( 'post' );

		if ( ! $no_conflict && ! empty( $data['post_type'] ) && ! empty( $postarr['ID'] ) ) {
			$pod = $data['post_type'];
			$id  = $postarr['ID'];

			PodsAPI::handle_changed_fields( $pod, $id, 'reset' );
		}

		return $data;

	}
465164
protected static function convert_fields(\stdClass $data) {
        $data = parent::convert_fields($data);

        if (!empty($data->lawfulbases) && is_array($data->lawfulbases)) {
            $data->lawfulbases = implode(',', $data->lawfulbases);
        }
        if (!empty($data->sensitivedatareasons) && is_array($data->sensitivedatareasons)) {
            $data->sensitivedatareasons = implode(',', $data->sensitivedatareasons);
        }

        // A single value.
        $data->retentionperiod = 'P' . $data->retentionperiodnumber . $data->retentionperiodunit;
        unset($data->retentionperiodnumber);
        unset($data->retentionperiodunit);

        return $data;
    }
114370
protected function convert_existing_data_to_values(\stdClass $data) : \stdClass {
        $data->lawfulbases = explode(',', $data->lawfulbases);
        if (!empty($data->sensitivedatareasons)) {
            $data->sensitivedatareasons = explode(',', $data->sensitivedatareasons);
        }

        // Convert the single properties into number and unit.
        $strlen = strlen($data->retentionperiod);
        $data->retentionperiodnumber = substr($data->retentionperiod, 1, $strlen - 2);
        $data->retentionperiodunit = substr($data->retentionperiod, $strlen - 1);
        unset($data->retentionperiod);

        return $data;
    }