Mongolid\DataMapper\SchemaMapper::map PHP Method

map() public method

Maps the input $data to the schema specified in the $schema property.
public map ( array | object $data ) : array
$data array | object Array or object with the fields that should be mapped to $this->schema specifications.
return array
    public function map($data)
    {
        $data = $this->parseToArray($data);
        $this->clearDynamic($data);
        // Parse each specified field
        foreach ($this->schema->fields as $key => $fieldType) {
            $data[$key] = $this->parseField($data[$key] ?? null, $fieldType);
        }
        $data = Ioc::make(Converter::class)->toMongoTypes($data);
        return $data;
    }