Skip to content

Commit

Permalink
Revert "FIx magento#14958 - fix integration tests"
Browse files Browse the repository at this point in the history
This reverts commit 8dab9d7.
  • Loading branch information
Bartlomiejsz committed Apr 15, 2019
1 parent 8dab9d7 commit 4385c2f
Showing 1 changed file with 4 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
namespace Magento\TestFramework\Db\Sequence;

use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Webapi\Exception;
use Magento\SalesSequence\Model\ResourceModel\Meta as ResourceMetadata;
use Magento\Framework\App\ResourceConnection as AppResource;
use Magento\Framework\DB\Ddl\Sequence as DdlSequence;
use Magento\Framework\Webapi\Exception;
use Magento\SalesSequence\Model\MetaFactory;
use Magento\SalesSequence\Model\ProfileFactory;
use Magento\SalesSequence\Model\ResourceModel\Meta as ResourceMetadata;
use Magento\SalesSequence\Model\ResourceModel\Profile as ResourceProfile;
use Magento\SalesSequence\Model\MetaFactory;

/**
* Class Builder
Expand Down Expand Up @@ -70,11 +69,6 @@ class Builder extends \Magento\SalesSequence\Model\Builder
'warning_value',
];

/**
* @var ResourceProfile
*/
protected $resourceProfile;

/**
* Concrete data of sequence
*
Expand All @@ -88,22 +82,19 @@ class Builder extends \Magento\SalesSequence\Model\Builder
* @param ProfileFactory $profileFactory
* @param AppResource $appResource
* @param DdlSequence $ddlSequence
* @param ResourceProfile $resourceProfile
*/
public function __construct(
ResourceMetadata $resourceMetadata,
MetaFactory $metaFactory,
ProfileFactory $profileFactory,
AppResource $appResource,
DdlSequence $ddlSequence,
ResourceProfile $resourceProfile
DdlSequence $ddlSequence
) {
$this->resourceMetadata = $resourceMetadata;
$this->metaFactory = $metaFactory;
$this->profileFactory = $profileFactory;
$this->appResource = $appResource;
$this->ddlSequence = $ddlSequence;
$this->resourceProfile = $resourceProfile;
$this->data = array_flip($this->pattern);
}

Expand Down Expand Up @@ -272,33 +263,4 @@ public function create()
}
$this->data = array_flip($this->pattern);
}

/**
* Deletes all sequence linked entites
*
* @param $storeId
*
* @return void
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function deleteByStoreId($storeId)
{
$metadataIds = $this->resourceMetadata->getIdsByStore($storeId);
$profileIds = $this->resourceProfile->getProfileIdsByMetadataIds($metadataIds);

$this->appResource->getConnection()->delete(
$this->appResource->getTableName('sales_sequence_profile'),
['profile_id IN (?)' => $profileIds]
);

foreach ($metadataIds as $metadataId) {
$metadata = $this->metaFactory->create();
$this->resourceMetadata->load($metadata, $metadataId);
if (!$metadata->getId()) {
continue;
}

$this->resourceMetadata->delete($metadata);
}
}
}

0 comments on commit 4385c2f

Please sign in to comment.