PHP code example of seacommerce / mapper

1. Go to this page and download the library: Download seacommerce/mapper 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/ */

    

seacommerce / mapper example snippets


class A
{
  private $id;
  private $name;
  private $desc;
  private $day;
  private $type;
  private $active;
  
  // Getters & Setters
}

class B
{
  private $id;
  private $name;
  private $type
  private $active
  
  
  // Getters & Setters
}

$b = new B();
$b->setId($a->getId());
$b->setName($a->getName());
$b->setType($a->getType());
$b->setIsActive($a->getIsActive());

$b = $mapper->map($a, B::class);

$mapper
  ->forMember('id', Operation::mapFrom('prodcutId'))
  ->formember('dateCreated', Operation::ignore());

sdfsf