Added Mapping functionality
This commit is contained in:
13
src/Concept/Model/Mapping.php
Normal file
13
src/Concept/Model/Mapping.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace ProVM\Concept\Model;
|
||||
|
||||
interface Mapping
|
||||
{
|
||||
public function getInputName(): string;
|
||||
public function getOutputName(): string;
|
||||
public function getTransformation(): callable;
|
||||
public function setInputName(string $input): Mapping;
|
||||
public function setOutputName(string $output): Mapping;
|
||||
public function setTransformation(callable $transformation): Mapping;
|
||||
public function __invoke(mixed $input, mixed &$output, ?array $params = null): mixed;
|
||||
}
|
@ -81,38 +81,38 @@ interface Repository
|
||||
public function setTable(string $table): Repository;
|
||||
|
||||
/**
|
||||
* Get Model - table mapping
|
||||
* @return array
|
||||
*/
|
||||
public function getMappings(): array;
|
||||
public function getColumnMappings(): array;
|
||||
|
||||
/**
|
||||
* @param string $column
|
||||
* @param string $property
|
||||
* @param Mapping $mapping
|
||||
* @return Repository
|
||||
*/
|
||||
public function addMapping(string $column, string $property): Repository;
|
||||
public function addColumnMapping(Mapping $mapping): Repository;
|
||||
|
||||
/**
|
||||
* Set Model - table mappings
|
||||
* @param array $mappings
|
||||
* @return Repository
|
||||
*/
|
||||
public function setMappings(array $mappings): Repository;
|
||||
public function setColumnMappings(array $mappings): Repository;
|
||||
|
||||
/**
|
||||
* Find a property from mapping by column
|
||||
* @param string $column
|
||||
* @return string
|
||||
* @return array
|
||||
*/
|
||||
public function findPropertyByColumn(string $column): string;
|
||||
public function getPropertyMappings(): array;
|
||||
|
||||
/**
|
||||
* Find a column from mapping by property
|
||||
* @param string $property
|
||||
* @return string
|
||||
* @param Mapping $mapping
|
||||
* @return Repository
|
||||
*/
|
||||
public function findColumnByProperty(string $property): string;
|
||||
public function addPropertyMapping(Mapping $mapping): Repository;
|
||||
|
||||
/**
|
||||
* @param array $mappings
|
||||
* @return Repository
|
||||
*/
|
||||
public function setPropertyMappings(array $mappings): Repository;
|
||||
|
||||
/**
|
||||
* Set columns in table
|
||||
|
Reference in New Issue
Block a user