Created
December 9, 2014 14:53
-
-
Save ezimuel/5d76d38f767909d78d5c to your computer and use it in GitHub Desktop.
Example of Entity for Apigility
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
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