Skip to content

Instantly share code, notes, and snippets.

@mridgway
Created March 24, 2011 14:11
Show Gist options
  • Save mridgway/885123 to your computer and use it in GitHub Desktop.
Save mridgway/885123 to your computer and use it in GitHub Desktop.
<?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