| @@ 44-61 (lines=18) @@ | ||
| 41 | * |
|
| 42 | * @return array The initialized stock status |
|
| 43 | */ |
|
| 44 | public function initializeStockStatus(array $attr) |
|
| 45 | { |
|
| 46 | ||
| 47 | // load the stock status with the passed product/website/stock ID |
|
| 48 | $entity = $this->loadStockStatus( |
|
| 49 | $attr[MemberNames::PRODUCT_ID], |
|
| 50 | $attr[MemberNames::WEBSITE_ID], |
|
| 51 | $attr[MemberNames::STOCK_ID] |
|
| 52 | ); |
|
| 53 | ||
| 54 | // merge the attributes with the entity, if available |
|
| 55 | if ($entity) { |
|
| 56 | return $this->mergeEntity($entity, $attr); |
|
| 57 | } |
|
| 58 | ||
| 59 | // otherwise simply return the attributes |
|
| 60 | return $attr; |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * Initialize the stock item with the passed attributes and returns an instance. |
|
| @@ 70-87 (lines=18) @@ | ||
| 67 | * |
|
| 68 | * @return array The initialized stock item |
|
| 69 | */ |
|
| 70 | public function initializeStockItem(array $attr) |
|
| 71 | { |
|
| 72 | ||
| 73 | // load the stock item with the passed item/product/stock ID |
|
| 74 | $entity = $this->loadStockItem( |
|
| 75 | $attr[MemberNames::PRODUCT_ID], |
|
| 76 | $attr[MemberNames::WEBSITE_ID], |
|
| 77 | $attr[MemberNames::STOCK_ID] |
|
| 78 | ); |
|
| 79 | ||
| 80 | // merge the attributes with the entity, if available |
|
| 81 | if ($entity) { |
|
| 82 | return $this->mergeEntity($entity, $attr); |
|
| 83 | } |
|
| 84 | ||
| 85 | // otherwise simply return the attributes |
|
| 86 | return $attr; |
|
| 87 | } |
|
| 88 | ||
| 89 | /** |
|
| 90 | * Load's and return's the stock status with the passed product/website/stock ID. |
|