-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Move more mapping logic to
ObjectMappingResolver
.
- Loading branch information
Showing
10 changed files
with
357 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/Transformer/ObjectMappingResolver/Contracts/ConstructorMapping.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of rekalogika/mapper package. | ||
* | ||
* (c) Priyadi Iman Nurcahyo <https://rekalogika.dev> | ||
* | ||
* For the full copyright and license information, please view the LICENSE file | ||
* that was distributed with this source code. | ||
*/ | ||
|
||
namespace Rekalogika\Mapper\Transformer\ObjectMappingResolver\Contracts; | ||
|
||
use Symfony\Component\PropertyInfo\Type; | ||
|
||
final class ConstructorMapping | ||
{ | ||
/** | ||
* @var array<int,Type> $targetTypes | ||
*/ | ||
private array $targetTypes; | ||
|
||
/** | ||
* @param array<array-key,Type> $targetTypes | ||
*/ | ||
public function __construct( | ||
private ?string $sourceProperty, | ||
private string $targetProperty, | ||
array $targetTypes, | ||
) { | ||
$this->targetTypes = array_values($targetTypes); | ||
} | ||
|
||
public function getSourceProperty(): ?string | ||
{ | ||
return $this->sourceProperty; | ||
} | ||
|
||
public function getTargetProperty(): string | ||
{ | ||
return $this->targetProperty; | ||
} | ||
|
||
/** | ||
* @return array<int,Type> | ||
*/ | ||
public function getTargetTypes(): array | ||
{ | ||
return $this->targetTypes; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
src/Transformer/ObjectMappingResolver/Contracts/ObjectMappingEntry.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/Transformer/ObjectMappingResolver/Contracts/PropertyMapping.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of rekalogika/mapper package. | ||
* | ||
* (c) Priyadi Iman Nurcahyo <https://rekalogika.dev> | ||
* | ||
* For the full copyright and license information, please view the LICENSE file | ||
* that was distributed with this source code. | ||
*/ | ||
|
||
namespace Rekalogika\Mapper\Transformer\ObjectMappingResolver\Contracts; | ||
|
||
use Symfony\Component\PropertyInfo\Type; | ||
|
||
final class PropertyMapping | ||
{ | ||
/** | ||
* @var array<int,Type> $targetTypes | ||
*/ | ||
private array $targetTypes; | ||
|
||
/** | ||
* @param array<array-key,Type> $targetTypes | ||
*/ | ||
public function __construct( | ||
private string $sourceProperty, | ||
private string $targetProperty, | ||
array $targetTypes, | ||
) { | ||
$this->targetTypes = array_values($targetTypes); | ||
} | ||
|
||
public function getSourceProperty(): string | ||
{ | ||
return $this->sourceProperty; | ||
} | ||
|
||
public function getTargetProperty(): string | ||
{ | ||
return $this->targetProperty; | ||
} | ||
|
||
/** | ||
* @return array<int,Type> | ||
*/ | ||
public function getTargetTypes(): array | ||
{ | ||
return $this->targetTypes; | ||
} | ||
} |
Oops, something went wrong.