-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
167 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...tion/Plugin/Synchronization/SynchronizationDataQueryExpanderOffsetLimitStrategyPlugin.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. | ||
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
*/ | ||
|
||
namespace Spryker\Zed\Synchronization\Communication\Plugin\Synchronization; | ||
|
||
use Generated\Shared\Transfer\SynchronizationDataQueryExpanderStrategyConfigurationTransfer; | ||
use Propel\Runtime\ActiveQuery\ModelCriteria; | ||
use Spryker\Zed\SynchronizationExtension\Dependency\Plugin\SynchronizationDataQueryExpanderStrategyPluginInterface; | ||
|
||
class SynchronizationDataQueryExpanderOffsetLimitStrategyPlugin implements SynchronizationDataQueryExpanderStrategyPluginInterface | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
* | ||
* @api | ||
* | ||
* @param \Propel\Runtime\ActiveQuery\ModelCriteria $query | ||
* @param \Generated\Shared\Transfer\SynchronizationDataQueryExpanderStrategyConfigurationTransfer $synchronizationDataQueryExpanderStrategyConfigurationTransfer | ||
* | ||
* @return \Propel\Runtime\ActiveQuery\ModelCriteria | ||
*/ | ||
public function expandQuery( | ||
ModelCriteria $query, | ||
SynchronizationDataQueryExpanderStrategyConfigurationTransfer $synchronizationDataQueryExpanderStrategyConfigurationTransfer | ||
): ModelCriteria { | ||
$query | ||
->offset($synchronizationDataQueryExpanderStrategyConfigurationTransfer->getOffsetOrFail()) | ||
->limit($synchronizationDataQueryExpanderStrategyConfigurationTransfer->getChunkSizeOrFail()); | ||
|
||
return $query; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...ion/Plugin/Synchronization/SynchronizationDataQueryExpanderWhereBetweenStrategyPlugin.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. | ||
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
*/ | ||
|
||
namespace Spryker\Zed\Synchronization\Communication\Plugin\Synchronization; | ||
|
||
use Generated\Shared\Transfer\SynchronizationDataQueryExpanderStrategyConfigurationTransfer; | ||
use Propel\Runtime\ActiveQuery\ModelCriteria; | ||
use Spryker\Zed\SynchronizationExtension\Dependency\Plugin\SynchronizationDataQueryExpanderStrategyPluginInterface; | ||
|
||
class SynchronizationDataQueryExpanderWhereBetweenStrategyPlugin implements SynchronizationDataQueryExpanderStrategyPluginInterface | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
* | ||
* @api | ||
* | ||
* @param \Propel\Runtime\ActiveQuery\ModelCriteria $query | ||
* @param \Generated\Shared\Transfer\SynchronizationDataQueryExpanderStrategyConfigurationTransfer $synchronizationDataQueryExpanderStrategyConfigurationTransfer | ||
* | ||
* @return \Propel\Runtime\ActiveQuery\ModelCriteria | ||
*/ | ||
public function expandQuery( | ||
ModelCriteria $query, | ||
SynchronizationDataQueryExpanderStrategyConfigurationTransfer $synchronizationDataQueryExpanderStrategyConfigurationTransfer | ||
): ModelCriteria { | ||
$primaryKeys = $query->getTableMap()->getPrimaryKeys(); | ||
|
||
$offset = $synchronizationDataQueryExpanderStrategyConfigurationTransfer->getOffsetOrFail(); | ||
$chunkSize = $synchronizationDataQueryExpanderStrategyConfigurationTransfer->getChunkSizeOrFail(); | ||
|
||
$nextRange = $offset + $chunkSize; | ||
|
||
$query | ||
->where(sprintf('%s BETWEEN %s AND %s', key($primaryKeys), $offset, $nextRange)); | ||
|
||
return $query; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters