Skip to content

Instantly share code, notes, and snippets.

@ezimuel
Created December 9, 2014 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ezimuel/5d76d38f767909d78d5c to your computer and use it in GitHub Desktop.
Save ezimuel/5d76d38f767909d78d5c to your computer and use it in GitHub Desktop.
Example of Entity for Apigility
namespace Ecommerce\V1\Rest\Catalog;
class CatalogEntity
{
public $id;
public $name;
public $description;
public $picture;
public $price;
public $quantity;
public function getArrayCopy()
{
return array(
'id' => $this->id,
'name' => $this->name,
'description' => $this->description,
'picture' => $this->picture,
'price' => $this->price,
'quantity' => $this->quantity
);
}
public function exchangeArray(array $array)
{
$this->id = $array['id'];
$this->name = $array['name'];
$this->description = $array['description'];
$this->picture = $array['picture'];
$this->price = $array['price'];
$this->quantity = $array['quantity'];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment