Processes a raw MongoDB record and normalizes it into a standard array.

@param   EntityMetadata  $metadata
@param   array           $record
@param   Store           $store
@return  array
972260
public function normalize(EntityMetadata $metadata, array $record, Store $store)
    {
        // Get the identifier and model type value from the raw record.
        list($identifier, $type) = $this->extractIdAndType($metadata, $record);

        // Reload the metadata in case a polymorphic type was found.
        $metadata = $store->getMetadataForType($type);

        // Convert relationships to the proper format.
        $record = $this->convertRelationships($metadata, $record);

        return [
            'identifier'    => (String) $identifier,
            'type'          => $type,
            'properties'    => $record,
        ];
    }
80190
protected function mapMapping(array $record, Mapping $mapping, $context = null, $key = null)
    {
        $mapped = $this->mapFragment($record, $mapping->toArray(), $context, $key);

        if ($mapping->isWrapped()) {
            // Unwrap.
            return $mapped[0];
        }

        return $mapped;
    }
1018588
private function getQueryRelConverter(Store $store, RelationshipMetadata $relMeta)
    {
        $related = $store->getMetadataForType($relMeta->getEntityType());
        return $this->getQueryRootConverter($related, Persister::IDENTIFIER_KEY);
    }
1198382
protected function processRecord(array $record): array
    {
        foreach ($this->processors as $processor) {
            $record = $processor($record);
        }

        return $record;
    }
777342
public function transformRecordsToObjects($records)
    {
        if ($this->recordClass) {
            $recordClass = $this->recordClass;
            foreach ($records as &$record) {
                $record = (new $recordClass($record));
            }
        }

        return $records;
    }
267460
private function translateRecordIntoEventMessage(array $record)
    {
        $identifier = new MessageIdentifier($record['event_id']);

        $payload = $this->eventSerializer->deserializePayload(
            $record['event_payload'],
            Contract::createFromClassName($record['event_payload_type'])
        );

        $metadata = $this->eventSerializer->deserializeMetadata(
            $record['event_metadata'],
            Contract::createFromClassName($record['event_metadata_type'])
        );

        $sequenceNumber = (int) $record['aggregate_version'];

        $eventMessage = new GenericEvent($this->aggregateRootIdentifier, $sequenceNumber, $identifier, $payload, $metadata);

        return $eventMessage;
    }
294816
public function createCursorRecordSet(EntityMetadata $metadata, Cursor $cursor, Store $store)
    {
        return new CursorRecordSet($metadata, $cursor, $store, $this);
    }
656087
protected function processRecord(Record $record)
    {

        foreach ($this->processors as $processor) {
            if ($this->isInstanceOf($processor, ProcessorInterface::class)) {
                $processor->processRecord($record);
            } else {
                call_user_func($processor, $record);
            }
        }
    }
791222
public function format(array $record)
    {
        $jsonString = json_encode($this->getOutputRecord($record));

        if ($jsonString === false) {
            throw new \RuntimeException('Error happened during the log format process! (json encode error)');
        }

        return $jsonString . PHP_EOL;
    }
1070376
private function decodeResult(array $record): AbstractResult
    {
        $record = $this->preParse($record);

        if ($this->isValidResult($record)) {
            $unit = new Result($record['id'], $record['result']);
        } elseif ($this->isValidError($record)) {
            $exceptionClass = $this->exceptionMap[$record['error']['code']] ?? ServerErrorException::class;
            $unit = new Error($record['id'], new $exceptionClass(
                $record['error']['data']['message'] ?? $record['error']['message'] ?? 'Server error',
                $record['error']['data']['code'] ?? 0
            ));
        } else {
            throw new InvalidResponseException();
        }

        return $unit;
    }
906090
public function normalizeFromPost($entity, $target)
    {
        $key = $this->mapping['fieldname'];
        $accessor = 'get' . ucfirst($key);

        $outerCollection = $entity->$accessor();
        if ($outerCollection === null || $outerCollection instanceof Collections\Collection) {
            return null;
        }

        /** @var Collection\Taxonomy|Collection\Relations $collection */
        $collection = $this->em->createCollection($target);

        if (is_string($outerCollection)) {
            $outerCollection = [$outerCollection];
        }

        if (is_array($outerCollection)) {
            $related = [
                $key => $outerCollection,
            ];
            $collection->setFromPost($related, $entity);
        }

        return $collection;
    }
961053
protected function denormalizeCollection($collection, $class, $name, $format = null, array $context = array())
    {
        /** @var ClassMetadata $meta */
        $meta = $context['entityMeta'];

        $targetEntity = $meta->associationMappings[$name]['targetEntity'];

        $result = array();
        foreach ($collection as $key => $element) {
            $class = $class ?: $targetEntity;

            $result[$key] = $this->denormalizeAssociation($element, $class, $name, $format, $context);
        }

        return $result;
    }
163841
final public static function instantiate (array $record)
	{
		$className 	= get_called_class();
		$object 	= new $className;
		foreach ($record as $attribute => $value):
			$object->$attribute = $value;
		endforeach;
		return $object;
	}
357663
public function edit($entity, $id, $child = null, $record = null)
    {
        if (!$record && !$child && ($entityObject = Entity::fromYamlFile($entity))) {
            // Get the record from the database, or fail if it is not found
            $entityClass = $entityObject->class;
            $record = $entityClass::findOrFail($id);

            $form = new Form($entityObject, $record, Session::get('errors'));

            return $form->view();
        } elseif (($parentEntity = Entity::fromYamlFile($entity)) && ($entityObject = Entity::fromYamlFile($child))) {
            // Get parent's record
            $parentRecord = $parentEntity->class::findOrFail($id);

            // Get the record from the database, or fail if it is not found
            $entityClass = $entityObject->class;
            $childObject = $entityClass::findOrFail($record);

            $form = new Form($entityObject, $childObject, Session::get('errors'), $parentEntity, $parentRecord);

            return $form->view();
        } else {
            abort(404);
        }
    }
314560
protected function buildContent($record)
    {
        if (strlen($record['formatted']) > $this->limit) {
            $record['formatted'] = substr($record['formatted'], 0, $this->limit);
        }

        $dataArray = [
            'content' => $record['formatted'],
            'to' => (!is_array($this->toNumber)? [$this->toNumber] : $this->toNumber)
        ];

        ($this->fromNumber)? $dataArray['from'] = $this->fromNumber : false;

        return json_encode($dataArray);
    }
1088441
protected function processRecords(array $records)
    {
        $record = new Record();
        $formatter = $this->getFormatter();
        if ($this->isInstanceOf($formatter, FormatterInterface::class)) {
            $formatter->formatRecords($records, $record);
        }

        $this->write($record);

        return $this->bubble;
    }
307739
private function processRecord(array $record): ?int
    {
        $requestId = $record['requestId'];

        $content = 0 === $record['contentLength'] ? null : $record['contentData'];

        if (DaemonInterface::FCGI_BEGIN_REQUEST === $record['type']) {
            $this->processBeginRequestRecord($requestId, $content);
        } elseif (!isset($this->requests[$requestId])) {
            throw new ProtocolException('Invalid request id for record of type: '.$record['type']);
        } elseif (DaemonInterface::FCGI_PARAMS === $record['type']) {
            while (null !== $content && strlen($content) > 0) {
                $this->readNameValuePair($requestId, $content);
            }
        } elseif (DaemonInterface::FCGI_STDIN === $record['type']) {
            if (null !== $content) {
                fwrite($this->requests[$requestId]['stdin'], $content);
            } else {
                // Returns the status code
                return $this->dispatchRequest($requestId);
            }
        } elseif (DaemonInterface::FCGI_ABORT_REQUEST === $record['type']) {
            $this->endRequest($requestId);
        } else {
            throw new ProtocolException('Unexpected packet of type: '.$record['type']);
        }

        return null; // No status code to return
    }