| @@ 45-60 (lines=16) @@ | ||
| 42 | * |
|
| 43 | * @return array The initialized product link |
|
| 44 | */ |
|
| 45 | protected function initializeProductLink(array $attr) |
|
| 46 | { |
|
| 47 | ||
| 48 | // load the product/linked product/link type ID |
|
| 49 | $productId = $attr[MemberNames::PRODUCT_ID]; |
|
| 50 | $linkTypeId = $attr[MemberNames::LINK_TYPE_ID]; |
|
| 51 | $linkedProductId = $attr[MemberNames::LINKED_PRODUCT_ID]; |
|
| 52 | ||
| 53 | // try to load the link with the passed product/linked product/link type ID |
|
| 54 | if ($entity = $this->loadProductLink($productId, $linkedProductId, $linkTypeId)) { |
|
| 55 | return $this->mergeEntity($entity, $attr); |
|
| 56 | } |
|
| 57 | ||
| 58 | // simply return the attributes |
|
| 59 | return $attr; |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * Load's the link with the passed product/linked product/link type ID. |
|
| @@ 132-147 (lines=16) @@ | ||
| 129 | * |
|
| 130 | * @return array The initialized product link |
|
| 131 | */ |
|
| 132 | protected function initializeProductLink(array $attr) |
|
| 133 | { |
|
| 134 | ||
| 135 | // load the product/linked product/link type ID |
|
| 136 | $productId = $attr[MemberNames::PRODUCT_ID]; |
|
| 137 | $linkTypeId = $attr[MemberNames::LINK_TYPE_ID]; |
|
| 138 | $linkedProductId = $attr[MemberNames::LINKED_PRODUCT_ID]; |
|
| 139 | ||
| 140 | // try to load the link with the passed product/linked product/link type ID |
|
| 141 | if ($entity = $this->loadProductLink($productId, $linkedProductId, $linkTypeId)) { |
|
| 142 | return $this->mergeEntity($entity, $attr); |
|
| 143 | } |
|
| 144 | ||
| 145 | // simply return the attributes |
|
| 146 | return $attr; |
|
| 147 | } |
|
| 148 | ||
| 149 | /** |
|
| 150 | * Load's the link with the passed product/linked product/link type ID. |
|