Skip to content

Commit

Permalink
Merge pull request #72 from logeecom/dev
Browse files Browse the repository at this point in the history
Release version 3.3.9
  • Loading branch information
Moratojkd authored May 31, 2022
2 parents 2762650 + 1f37e54 commit 26de21b
Show file tree
Hide file tree
Showing 18 changed files with 288 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ 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/).

## [3.3.9](https://github.com/packlink-dev/ecommerce_module_core/compare/v3.3.8...v3.3.9) - 2022-05-30
### Added
- Added `__serialize` and `__unserialize` methods to `Serializable` interface in order to add compatibility with PHP8.1.
- Implemented `__serialize` and `__unserialize` methods in all classes that implement `Serializable` interface.

## [3.3.8](https://github.com/packlink-dev/ecommerce_module_core/compare/v3.3.7...v3.3.8) - 2022-05-09
### Added
- Added carrier logos for Colis Prive and Shop2Shop shipping services.
Expand Down
15 changes: 15 additions & 0 deletions src/BusinessLogic/Scheduler/ScheduleCheckTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ public function toArray()
return array();
}

/**
* @inheritDoc
*/
public function __serialize()
{
return $this->toArray();
}

/**
* @inheritDoc
*/
public function __unserialize($data)
{
}

/**
* Runs task logic.
*
Expand Down
17 changes: 17 additions & 0 deletions src/BusinessLogic/Tasks/BatchTaskCleanupTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,23 @@ public static function fromArray(array $array)
return new static($array['taskStatuses'], $array['taskTypes']);
}

/**
* @inheritDoc
*/
public function __serialize()
{
return $this->toArray();
}

/**
* @inheritDoc
*/
public function __unserialize($data)
{
$this->taskStatuses = $data['taskStatuses'];
$this->taskTypes = $data['taskTypes'];
}

/**
* Executes the task.
*
Expand Down
15 changes: 15 additions & 0 deletions src/BusinessLogic/Tasks/GetDefaultParcelAndWarehouseTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ public function toArray()
return array();
}

/**
* @inheritDoc
*/
public function __serialize()
{
return $this->toArray();
}

/**
* @inheritDoc
*/
public function __unserialize($data)
{
}

/**
* Runs task logic.
*
Expand Down
16 changes: 16 additions & 0 deletions src/BusinessLogic/Tasks/SendDraftTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ public function toArray()
return array('order_id' => $this->orderId);
}

/**
* @inheritDoc
*/
public function __serialize()
{
return $this->toArray();
}

/**
* @inheritDoc
*/
public function __unserialize($data)
{
$this->orderId = $data['order_id'];
}

/**
* String representation of object
*
Expand Down
18 changes: 18 additions & 0 deletions src/BusinessLogic/Tasks/TaskCleanupTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,24 @@ public function toArray()
);
}

/**
* @inheritDoc
*/
public function __serialize()
{
return $this->toArray();
}

/**
* @inheritDoc
*/
public function __unserialize($data)
{
$this->taskType = $data['task_type'];
$this->taskStatuses = $data['task_statuses'];
$this->taskAge = $data['task_age'];
}

/**
* @inheritdoc
*/
Expand Down
19 changes: 19 additions & 0 deletions src/BusinessLogic/Tasks/UpdateShipmentDataTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,25 @@ public function toArray()
);
}

/**
* @inheritDoc
*/
public function __serialize()
{
return $this->toArray();
}

/**
* @inheritDoc
*/
public function __unserialize($data)
{
$this->progress = $data['progress'];
$this->progressStep = $data['progress_step'];
$this->references = $data['references'];
$this->orderStatuses = $data['order_statuses'];
}

/**
* @inheritdoc
*/
Expand Down
15 changes: 15 additions & 0 deletions src/BusinessLogic/Tasks/UpdateShippingServicesTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@ public function toArray()
return array();
}

/**
* @inheritDoc
*/
public function __serialize()
{
return $this->toArray();
}

/**
* @inheritDoc
*/
public function __unserialize($data)
{
}

/**
* Gets all local methods and remote services and synchronizes data.
*
Expand Down
16 changes: 16 additions & 0 deletions src/Infrastructure/AutoTest/AutoTestTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ public function toArray()
return array('data' => $this->data);
}

/**
* @inheritDoc
*/
public function __serialize()
{
return $this->toArray();
}

/**
* @inheritDoc
*/
public function __unserialize($data)
{
$this->data = $data['data'];
}

/**
* String representation of object.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Infrastructure/Serializer/Concrete/JsonSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class JsonSerializer extends Serializer
*/
protected function doSerialize($data)
{
if (!method_exists($data, 'toArray')) {
if (!in_array(gettype($data), ['object', 'string'], true) || !method_exists($data, 'toArray')) {
if ($data instanceof \stdClass) {
$data->className = get_class($data);
}
Expand Down
12 changes: 12 additions & 0 deletions src/Infrastructure/Serializer/Interfaces/Serializable.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,16 @@ public static function fromArray(array $array);
* @return array Array representation of a serializable object.
*/
public function toArray();

/**
* @return array
*/
public function __serialize();

/**
* @param array $data
*
* @return void
*/
public function __unserialize($data);
}
30 changes: 30 additions & 0 deletions src/Infrastructure/TaskExecution/AsyncBatchStarter.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,36 @@ public function toArray()
);
}

/**
* @inheritDoc
*/
public function __serialize()
{
return $this->toArray();
}

/**
* @inheritDoc
*/
public function __unserialize($data)
{
$this->batchSize = $data['batchSize'];
$this->addIndex = $data['addIndex'];

$runners = array();
$subBatches = array();
foreach ($data['runners'] as $runner) {
$runners[] = Serializer::unserialize($runner);
}

foreach ($data['subBatches'] as $subBatch) {
$subBatches[] = Serializer::unserialize($subBatch);
}

$this->runners = $runners;
$this->subBatches = $subBatches;
}

/**
* AsyncBatchStarter constructor.
*
Expand Down
27 changes: 27 additions & 0 deletions src/Infrastructure/TaskExecution/CompositeTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,33 @@ public function toArray()
);
}

/**
* @inheritDoc
*/
public function __serialize()
{
return $this->toArray();
}

/**
* @inheritDoc
*/
public function __unserialize($data)
{
$this->initialProgress = $data['initial_progress'];
$this->taskProgressMap = $data['task_progress_map'];
$this->tasksProgressShare = $data['tasks_progress_share'];

$tasks = array();
foreach ($data['tasks'] as $task) {
$tasks[] = Serializer::serialize($task);
}

$this->tasks = $tasks;

$this->registerSubTasksEvents();
}

/**
* @inheritdoc
*/
Expand Down
16 changes: 16 additions & 0 deletions src/Infrastructure/TaskExecution/QueueItemStarter.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@ public function toArray()
return array('queue_item_id' => $this->queueItemId);
}

/**
* @inheritDoc
*/
public function __serialize()
{
return $this->toArray();
}

/**
* @inheritDoc
*/
public function __unserialize($data)
{
$this->queueItemId = $data['queue_item_id'];
}

/**
* @inheritdoc
*/
Expand Down
16 changes: 16 additions & 0 deletions src/Infrastructure/TaskExecution/TaskRunnerStarter.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,22 @@ public function toArray()
return array('guid' => $this->guid);
}

/**
* @inheritDoc
*/
public function __serialize()
{
return $this->toArray();
}

/**
* @inheritDoc
*/
public function __unserialize($data)
{
$this->guid = $data['guid'];
}

/**
* String representation of object.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,19 @@ public function toArray()
{
return array();
}

/**
* @inheritDoc
*/
public function __serialize()
{
return $this->toArray();
}

/**
* @inheritDoc
*/
public function __unserialize($data)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,23 @@ public function toArray()
);
}

/**
* @inheritDoc
*/
public function __serialize()
{
return $this->toArray();
}

/**
* @inheritDoc
*/
public function __unserialize($data)
{
$this->testProperty = $data['testProperty'];
$this->callHistory = $data['callHistory'];
}

/**
* Starts runnable run logic.
*/
Expand Down
Loading

0 comments on commit 26de21b

Please sign in to comment.