Skip to content

Commit

Permalink
#44 update doc and do not prevent resource init on available properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ronan-gloo committed Jun 28, 2018
1 parent 09da74d commit dd5a8ca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/Api/Order/OrderItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,19 @@
*/
class OrderItem
{
/**
* @var string
*/
private $reference;

/**
* @var int
*/
private $quantity;

/**
* @var float
*/
private $unitPrice;

/**
Expand Down
6 changes: 4 additions & 2 deletions src/Resource/AbstractResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ public function toArray()
/**
* @param string $property The property name
* @param bool $initialize Indicates if the resource must be fetched from server
* in order to access to this property (when no present in partial representation)
* in order to access to this property (when not present in partial representation)
* The property absence in the current representation is mandatory to pull data
* from remote API
*
* @return mixed|null
*/
protected function getProperty($property, $initialize = false)
{
if (true === $initialize) {
if (true === $initialize && ! $this->resource->hasProperty($property)) {
$this->initialize();
}

Expand Down

0 comments on commit dd5a8ca

Please sign in to comment.