Created
March 24, 2011 14:11
-
-
Save mridgway/885123 to your computer and use it in GitHub Desktop.
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 | |
interface ArrayTransformer | |
{ | |
/** | |
* @abstract | |
* @param object $object | |
* @return array | |
*/ | |
public function toArray($object); | |
/** | |
* @abstract | |
* @param object $object | |
* @param array $data | |
* @return void | |
*/ | |
public function fromArray($object, array $data); | |
} | |
/** | |
* @oat:Transformable | |
*/ | |
class TestObject | |
{ | |
private $id; | |
private $name; | |
private $aggregates; | |
public function __construct($name) | |
{ | |
$this->setName($name); | |
$this->aggregates = new ArrayCollection(); | |
} | |
public function getId() | |
{ | |
return $this->id; | |
} | |
public function getName() | |
{ | |
return $this->name; | |
} | |
public function setName($name) | |
{ | |
$this->name = $name; | |
} | |
public function getAggregates() | |
{ | |
return $this->aggregates; | |
} | |
public function setAggregates(ArrayCollection $aggregates) | |
{ | |
$this->aggregates = $aggregates; | |
} | |
} | |
/** | |
* @oat:Transformable | |
*/ | |
class TestAggregate | |
{ | |
private $id; | |
private $name; | |
public function getId() | |
{ | |
return $this->id; | |
} | |
public function getName() | |
{ | |
return $this->name; | |
} | |
public function setName($name) | |
{ | |
$this->name = $name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment