Skip to content

Commit

Permalink
Added findBySku() to the MasterProductVariant interface
Browse files Browse the repository at this point in the history
- The `MasterProduct` interface no longer extends the `Product` interface
  • Loading branch information
fulopattila122 committed Apr 2, 2024
1 parent d9793f5 commit ff4304c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
- Added the `Address` DTO class (implements the `Address` interface)
- Added the `AdjusterAliases` class that for decoupling FQCNs from the database
- Added automatic mapping of adjuster FQCN <-> aliases when saving an adjustment into the DB and when calling the `getAdjuster()` method
- BC: Added the `findBySku()` method to the `Product` and `MasterProductVariant` interfaces
- BC: The `MasterProduct` interface no longer extends the `Product` interface
- BC: The `Checkout` interface now extends the `ArrayAccess` and the `Shippable` interfaces (until here, only the concrete classes have implementation it)
- BC: Added cart and order item models to the Relation morph map: the `adjustable_type` field in the `adjustments` table needs to be converted!
- BC: Added the `?CheckoutSubject` return type to the `getCart()` method of the `Checkout` interface
Expand Down
3 changes: 3 additions & 0 deletions src/MasterProduct/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
- Changed minimal Enum requirement to v4.2
- Added the `Stockable` interface to the `MasterProductVariant` Model
- Added the `backorder` field to product variants
- BC: Added the `findBySku()` method to the `MasterProductVariant` interface
- BC: The `MasterProduct` interface no longer extends the `Product` interface


## 3.x Series

Expand Down
7 changes: 5 additions & 2 deletions src/MasterProduct/Contracts/MasterProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@

use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Collection;
use Vanilo\Product\Contracts\Product;

/**
* @property-read Collection|MasterProductVariant[] $variants
*/
interface MasterProduct extends Product
interface MasterProduct
{
public function isActive(): bool;

public function title(): string;

public function variants(): HasMany;

public function createVariant(array $attributes): MasterProductVariant;
Expand Down
1 change: 1 addition & 0 deletions src/MasterProduct/Contracts/MasterProductVariant.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@

interface MasterProductVariant
{
public static function findBySku(string $sku): ?MasterProductVariant;
}

0 comments on commit ff4304c

Please sign in to comment.