Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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