PHP code example of proklung / dto-mapper-bundle

1. Go to this page and download the library: Download proklung/dto-mapper-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

proklung / dto-mapper-bundle example snippets


class EmployeVersionTwo
{
    /**
     * @var string $firstName
     */
    private $firstName = 'first name version two';

    /**
     * @var string $lastName
     */
    private $lastName = 'last name version two';

    /**
     * @var string $unused
     */
    private $unused = '';

    /**
     * @return string
     */
    public function getFirstName(): string
    {
        return $this->firstName;
    }

    /**
     * @return string
     */
    public function getLastName(): string
    {
        return $this->lastName;
    }
}
class EmployeDtoVersionTwo
{
    /**
     * @var string $firstName
     */
    public $firstName = 'first name dto';

    /**
     * @var string $lastName
     */
    public $lastName = 'last name dto';
}


$mapper = container()->get('dto_mapper_bundle.mapper');
$srcObj = new EmployeVersionTwo();

$result = $mapper->convert($srcObj, EmployeDtoVersionTwo::class);
var_dump($result);