Last active
December 5, 2017 18:42
-
-
Save mark-gerarts/030b4ad315ad72c72fd23fb834f66600 to your computer and use it in GitHub Desktop.
AutoMapper+ test case for issue #10
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
<?php | |
require 'vendor/autoload.php'; | |
use \AutoMapperPlus\AutoMapper; | |
use \AutoMapperPlus\Configuration\AutoMapperConfig; | |
class B | |
{ | |
public $x; | |
public function setX($x) | |
{ | |
$this->x = $x; | |
} | |
} | |
class A extends B {} | |
class Dto | |
{ | |
public $x; | |
} | |
$config = new AutoMapperConfig(); | |
$config->registerMapping(A::class, Dto::class); | |
$mapper = new AutoMapper($config); | |
$a = new A; | |
$a->setX('Some value'); | |
$result = $mapper->map($a, Dto::class); | |
echo $result->x; // => "Some value" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment