| Total Complexity | 5 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class AttributeValueRepository extends BaseRepository implements AttributeValueRepositoryInterface |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * AttributeValueRepository constructor. |
||
| 14 | * @param AttributeValue $attributeValue |
||
| 15 | */ |
||
| 16 | public function __construct(AttributeValue $attributeValue) |
||
| 17 | { |
||
| 18 | parent::__construct($attributeValue); |
||
| 19 | $this->model = $attributeValue; |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param Attribute $attribute |
||
| 24 | * @param array $data |
||
| 25 | * @return AttributeValue |
||
| 26 | */ |
||
| 27 | public function createAttributeValue(Attribute $attribute, array $data) : AttributeValue |
||
| 28 | { |
||
| 29 | $attributeValue = new AttributeValue($data); |
||
| 30 | $attributeValue->attribute()->associate($attribute); |
||
| 31 | $attributeValue->save(); |
||
| 32 | return $attributeValue; |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Create the attribute value and associate to the attribute |
||
| 37 | * |
||
| 38 | * @param Attribute $attribute |
||
| 39 | * @return AttributeValue |
||
| 40 | */ |
||
| 41 | public function associateToAttribute(Attribute $attribute) : AttributeValue |
||
| 42 | { |
||
| 43 | $this->model->attribute()->associate($attribute); |
||
| 44 | $this->model->save(); |
||
| 45 | return $this->model; |
||
|
|
|||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Remove association from the attribute |
||
| 50 | */ |
||
| 51 | public function dissociateFromAttribute() : bool |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return Collection |
||
| 58 | */ |
||
| 59 | public function findProductAttributes() : Collection |
||
| 62 | } |
||
| 63 | } |
||
| 64 |