8000 GitHub - dunice/Dto
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

dunice/Dto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DTO Component

DTO (Data Transfer Object) is a pattern used to encapsulate data information and transfer them between application layers.

This component allows to create and access DTOs based on arrays and objects.

Example

<?php
$params = array(
    'idPerson' => 1,
    'idAddress' => a
67FD
rray(
        'idAddress' => 1,
        'txAddress' => '5th Avenue, 1250'
    )
);
$dto = new \Dto\Mapping\Base($params);

$dto->getIdPerson(); // 1
$dto->getIdAddress(); // DtoObject
$dto->getIdAddress()->getIdAddress(); // 1
$dto->getIdAddress()->getTxAddress(); // 5th Avenue, 1250

Example

<?php
$params = array(
  'idPerson' => 1
);
$dto = new \Dto\Mapping\Base($params);

$dto->getIdPerson(); // 1

// Now set an address info
$dto->setIdAddress(array(
    'idAddress' => 1,
    'txAddress' => '5th Avenue, 1250'
));

$dto->getIdAddress(); // DtoObject
$dto->getIdAddress()->getIdAddress(); // 1
$dto->getIdAddress()->getTxAddress(); // 5th Avenue, 1250

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0