Skip to content

Commit

Permalink
Merge pull request #64 from logeecom/dev
Browse files Browse the repository at this point in the history
Release version 3.3.1
  • Loading branch information
Eusebio Soriano Benegas authored Aug 23, 2021
2 parents f4d3bb7 + a7b7bd2 commit 878e31d
Show file tree
Hide file tree
Showing 118 changed files with 889 additions and 180 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## Unreleased
## [3.3.1](https://github.com/packlink-dev/ecommerce_module_core/compare/v3.3.0...v3.3.1) - 2021-08-23
**BREAKING CHANGES**
### Changed
- Updated order service to set shipment custom reference when creating a draft.
- Added additional statuses to shipment status mapper.
- Updated codebase to adhere to the Shopware coding standards. Integrations need to update all classes that extend from the Core `Singleton` class and implement create method that will return an instance of itself.

## [3.3.0](https://github.com/packlink-dev/ecommerce_module_core/compare/v3.2.2...v3.3.0) - 2021-07-06
**BREAKING CHANGES**
Expand Down
2 changes: 1 addition & 1 deletion src/BusinessLogic/Brand/DTO/BrandConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function toArray()
*/
public static function fromArray(array $data)
{
$result = new static();
$result = new self();

$result->platformCode = $data['platform_code'];
$result->shippingServiceSource = $data['shipping_service_source'];
Expand Down
14 changes: 14 additions & 0 deletions src/BusinessLogic/Controllers/DTO/DashboardStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,18 @@ class DashboardStatus extends FrontDto
'isWarehouseSet',
'isOrderStatusMappingsSet',
);

/**
* Creates instance of this class.
*
* @param array $data
*
* @return static
*
* @noinspection PhpDocSignatureInspection
*/
public static function create(array $data)
{
return new self();
}
}
14 changes: 14 additions & 0 deletions src/BusinessLogic/Controllers/DTO/ModuleState.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,18 @@ class ModuleState extends FrontDto
protected static $fields = array(
'state',
);

/**
* Creates instance of this class.
*
* @param array $data
*
* @return static
*
* @noinspection PhpDocSignatureInspection
*/
public static function create(array $data)
{
return new self();
}
}
14 changes: 14 additions & 0 deletions src/BusinessLogic/Controllers/DTO/OnboardingState.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,18 @@ class OnboardingState extends FrontDto
protected static $fields = array(
'state',
);

/**
* Creates instance of this class.
*
* @param array $data
*
* @return static
*
* @noinspection PhpDocSignatureInspection
*/
public static function create(array $data)
{
return new self();
}
}
14 changes: 14 additions & 0 deletions src/BusinessLogic/Controllers/DTO/RegistrationResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,18 @@ class RegistrationResponse extends FrontDto
'termsAndConditionsUrl',
'privacyPolicyUrl',
);

/**
* Creates instance of this class.
*
* @param array $data
*
* @return static
*
* @noinspection PhpDocSignatureInspection
*/
public static function create(array $data)
{
return new self();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function toArray()
*/
public static function fromArray(array $raw)
{
$result = new static();
$result = new self();

$result->id = $raw['id'];
$result->activated = (bool)static::getDataValue($raw, 'activated', false);
Expand Down
14 changes: 14 additions & 0 deletions src/BusinessLogic/Country/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ class Country extends FrontDto
'postal_code',
);

/**
* Creates instance of this class.
*
* @param array $data
*
* @return static
*
* @noinspection PhpDocSignatureInspection
*/
public static function create(array $data)
{
return new self();
}

/**
* Transforms raw array data to its DTO.
*
Expand Down
12 changes: 12 additions & 0 deletions src/BusinessLogic/Country/CountryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ class CountryService extends BaseService
*/
protected $brandConfigurationService;

/**
* Creates instance of this class.
*
* @return static
*
* @noinspection PhpDocSignatureInspection
*/
public static function create()
{
return new self();
}

/**
* Returns a list of supported country DTOs.
*
Expand Down
12 changes: 12 additions & 0 deletions src/BusinessLogic/Country/WarehouseCountryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ class WarehouseCountryService extends CountryService
*/
protected static $instance;

/**
* Creates instance of this class.
*
* @return static
*
* @noinspection PhpDocSignatureInspection
*/
public static function create()
{
return new self();
}

/**
* Returns a list of supported country DTOs.
*
Expand Down
4 changes: 1 addition & 3 deletions src/BusinessLogic/DTO/BaseDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ abstract public function toArray();
*/
public static function fromArray(array $raw)
{
throw new \BadMethodCallException(
'Method "fromArray" not implemented! Given array: ' . print_r($raw, true)
);
return null;
}

/**
Expand Down
16 changes: 15 additions & 1 deletion src/BusinessLogic/DTO/FrontDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ abstract class FrontDto extends DataTransferObject
*/
protected static $requiredFields = array();

/**
* Creates instance of this class.
*
* @param array $data
*
* @return static
*
* @noinspection PhpDocSignatureInspection
*/
public static function create(array $data)
{
return null;
}

/**
* Transforms raw array data to its DTO.
*
Expand All @@ -43,7 +57,7 @@ public static function fromArray(array $raw)
{
static::validate($raw);

$result = new static();
$result = static::create($raw);
foreach ($raw as $field => $value) {
if (property_exists(static::CLASS_NAME, $field)) {
$result->$field = $value;
Expand Down
14 changes: 14 additions & 0 deletions src/BusinessLogic/DTO/ValidationError.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,18 @@ class ValidationError extends FrontDto
* @var array
*/
protected static $fields = array('code', 'field', 'message');

/**
* Creates instance of this class.
*
* @param array $data
*
* @return static
*
* @noinspection PhpDocSignatureInspection
*/
public static function create(array $data)
{
return new self();
}
}
4 changes: 2 additions & 2 deletions src/BusinessLogic/Http/DTO/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct($weight = 0.0, $width = 0.0, $height = 0.0, $length
*/
public static function defaultPackage()
{
return new static(1, 10, 10, 10);
return new self(1, 10, 10, 10);
}

/**
Expand All @@ -71,7 +71,7 @@ public static function defaultPackage()
*/
public static function fromArray(array $raw)
{
$instance = new static();
$instance = new self();
$instance->weight = static::getDataValue($raw, 'weight', 0.0);
$instance->length = static::getDataValue($raw, 'length', 0.0);
$instance->height = static::getDataValue($raw, 'height', 0.0);
Expand Down
14 changes: 14 additions & 0 deletions src/BusinessLogic/Http/DTO/ParcelInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ public static function defaultParcel()
);
}

/**
* Creates instance of this class.
*
* @param array $data
*
* @return static
*
* @noinspection PhpDocSignatureInspection
*/
public static function create(array $data)
{
return new self();
}

/**
* Generates validation errors for the payload.
*
Expand Down
2 changes: 1 addition & 1 deletion src/BusinessLogic/Http/DTO/PostalCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PostalCode extends DataTransferObject
*/
public static function fromArray(array $raw)
{
$instance = new static();
$instance = new self();

$instance->zipcode = !empty($raw['zipcode']) ? $raw['zipcode'] : '';
$instance->city = !empty($raw['city']['name']) ? $raw['city']['name'] : '';
Expand Down
2 changes: 1 addition & 1 deletion src/BusinessLogic/Http/DTO/PostalZone.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PostalZone extends DataTransferObject
*/
public static function fromArray(array $raw)
{
$instance = new static();
$instance = new self();

$instance->id = static::getDataValue($raw, 'id');
$instance->name = static::getDataValue($raw, 'name');
Expand Down
2 changes: 1 addition & 1 deletion src/BusinessLogic/Http/DTO/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function toArray()
*/
public static function fromArray(array $raw)
{
$shipment = new static();
$shipment = new self();
$date = static::getDataValue($raw, 'order_date');
if ($date) {
$shipment->orderDate = \DateTime::createFromFormat('Y-m-d', $date);
Expand Down
2 changes: 1 addition & 1 deletion src/BusinessLogic/Http/DTO/ShipmentLabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function __construct($link, $printed = false, $createTimestamp = 0)
*/
public static function fromArray(array $batchRaw)
{
return new static(
return new self(
static::getDataValue($batchRaw, 'link'),
static::getDataValue($batchRaw, 'printed', false),
static::getDataValue($batchRaw, 'createTime', 0)
Expand Down
2 changes: 1 addition & 1 deletion src/BusinessLogic/Http/DTO/ShippingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function toArray()
*/
public static function fromArray(array $raw)
{
$instance = new static();
$instance = new self();

$instance->id = (int)self::getDataValue($raw, 'service_id');
$instance->enabled = (bool)self::getDataValue($raw, 'enabled');
Expand Down
2 changes: 1 addition & 1 deletion src/BusinessLogic/Http/DTO/ShippingServiceDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function toArray()
*/
public static function fromArray(array $raw)
{
$instance = new static();
$instance = new self();

$instance->id = self::getDataValue($raw, 'id');
$instance->carrierName = self::getDataValue($raw, 'carrier_name');
Expand Down
2 changes: 1 addition & 1 deletion src/BusinessLogic/Http/DTO/ShippingServiceSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function toArray()
*/
public static function fromArray(array $raw)
{
$instance = new static();
$instance = new self();

$instance->serviceId = self::getDataValue($raw, 'service_id', null);
$instance->fromCountry = self::getDataValue($raw, 'from[country]');
Expand Down
2 changes: 1 addition & 1 deletion src/BusinessLogic/Http/DTO/SystemInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class SystemInfo extends DataTransferObject
*/
public static function fromArray(array $raw)
{
$instance = new static();
$instance = new self();

$instance->systemId = !empty($raw['system_id']) ? $raw['system_id'] : null;
$instance->systemName = !empty($raw['system_name']) ? $raw['system_name'] : '';
Expand Down
2 changes: 1 addition & 1 deletion src/BusinessLogic/Http/DTO/Tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function toArray()
*/
public static function fromArray(array $raw)
{
$tracking = new static();
$tracking = new self();
$tracking->timestamp = static::getDataValue($raw, 'timestamp');
$tracking->description = static::getDataValue($raw, 'description');
$tracking->city = static::getDataValue($raw, 'city');
Expand Down
2 changes: 1 addition & 1 deletion src/BusinessLogic/Http/DTO/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function toArray()
*/
public static function fromArray(array $raw)
{
$user = new static();
$user = new self();

$user->firstName = static::getDataValue($raw, 'name');
$user->lastName = static::getDataValue($raw, 'surname');
Expand Down
12 changes: 12 additions & 0 deletions src/BusinessLogic/Location/LocationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ protected function __construct()
$this->configuration = ServiceRegister::getService(Configuration::CLASS_NAME);
}

/**
* Creates instance of this class.
*
* @return static
*
* @noinspection PhpDocSignatureInspection
*/
public static function create()
{
return new self();
}

/**
* Returns array of locations for this shipping method.
*
Expand Down
2 changes: 1 addition & 1 deletion src/BusinessLogic/Order/Objects/TrackingHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TrackingHistory
*/
public static function fromArray(array $raw)
{
$result = new static();
$result = new self();
$result->setCity($raw['city']);
$result->setDescription($raw['description']);
$result->setTimestamp($raw['timestamp']);
Expand Down
Loading

0 comments on commit 878e31d

Please sign in to comment.