Skip to content

Commit

Permalink
Merge branch 'ntr/improve-order-state-e2e-test' into '6.0+ea'
Browse files Browse the repository at this point in the history
NTR - Improve waiting in order state and variant e2e tests

See merge request shopware/6/product/platform!81
  • Loading branch information
janbuecker committed Aug 6, 2019
2 parents b2e1e17 + d7a4b25 commit 49941c6
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 91 deletions.
2 changes: 0 additions & 2 deletions Content/Category/CategoryDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\SearchRanking;
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\WriteProtected;
use Shopware\Core\Framework\DataAbstractionLayer\Field\IdField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\IntField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\ManyToManyAssociationField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\ManyToOneAssociationField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\OneToManyAssociationField;
Expand Down Expand Up @@ -93,7 +92,6 @@ protected function defineFields(): FieldCollection
new FkField('media_id', 'mediaId', MediaDefinition::class),

(new BoolField('display_nested_products', 'displayNestedProducts'))->addFlags(new Required()),
(new IntField('auto_increment', 'autoIncrement'))->addFlags(new WriteProtected()),

(new TranslatedField('breadcrumb'))->addFlags(new WriteProtected()),
new TreeLevelField('level', 'level'),
Expand Down
15 changes: 0 additions & 15 deletions Content/Category/CategoryEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ class CategoryEntity extends Entity
*/
protected $parentId;

/**
* @var int
*/
protected $autoIncrement;

/**
* @var string|null
*/
Expand Down Expand Up @@ -279,16 +274,6 @@ public function setProducts(ProductCollection $products): void
$this->products = $products;
}

public function getAutoIncrement(): int
{
return $this->autoIncrement;
}

public function setAutoIncrement(int $autoIncrement): void
{
$this->autoIncrement = $autoIncrement;
}

public function getNestedProducts(): ?ProductCollection
{
return $this->nestedProducts;
Expand Down
2 changes: 0 additions & 2 deletions Content/Product/ProductDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ protected function defineFields(): FieldCollection
(new BlacklistRuleField())->addFlags(new ReadProtected(SalesChannelApiSource::class)),
(new WhitelistRuleField())->addFlags(new ReadProtected(SalesChannelApiSource::class)),

(new IntField('auto_increment', 'autoIncrement'))->addFlags(new WriteProtected()),

//not inherited fields
new BoolField('active', 'active'),
(new IntField('stock', 'stock'))->addFlags(new Required()),
Expand Down
15 changes: 0 additions & 15 deletions Content/Product/ProductEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ class ProductEntity extends Entity
*/
protected $childCount;

/**
* @var int
*/
protected $autoIncrement;

/**
* @var string|null
*/
Expand Down Expand Up @@ -912,16 +907,6 @@ public function setCategoriesRo(CategoryCollection $categoriesRo): void
$this->categoriesRo = $categoriesRo;
}

public function getAutoIncrement(): int
{
return $this->autoIncrement;
}

public function setAutoIncrement(int $autoIncrement): void
{
$this->autoIncrement = $autoIncrement;
}

public function getCoverId(): ?string
{
return $this->coverId;
Expand Down
12 changes: 2 additions & 10 deletions Framework/DataAbstractionLayer/Dbal/Common/IteratorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,8 @@ public function createIterator(EntityDefinition $definition): IterableQuery
$query->from($escaped);
$query->setMaxResults(50);

if ($definition->getFields()->has('autoIncrement')) {
$query->select([$escaped . '.auto_increment', 'LOWER(HEX(' . $escaped . '.id))']);
$query->andWhere($escaped . '.auto_increment > :lastId');
$query->addOrderBy($escaped . '.auto_increment');
$query->setParameter('lastId', 0);

return new LastIdQuery($query);
}

$query->select([$escaped . '.id', 'LOWER(HEX(' . $escaped . '.id))']);
$query->select('LOWER(HEX(' . $escaped . '.id))');
$query->orderBy($escaped . '.id', 'asc');
$query->setFirstResult(0);

return new OffsetQuery($query);
Expand Down
44 changes: 0 additions & 44 deletions Framework/DataAbstractionLayer/Dbal/Common/LastIdQuery.php

This file was deleted.

5 changes: 2 additions & 3 deletions Framework/DataAbstractionLayer/Dbal/Common/OffsetQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Shopware\Core\Framework\DataAbstractionLayer\Dbal\Common;

use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\Query\QueryBuilder;
use Shopware\Core\Framework\Doctrine\FetchModeHelper;

class OffsetQuery implements IterableQuery
{
Expand All @@ -24,8 +24,7 @@ public function __construct(QueryBuilder $query)

public function fetch(): array
{
$data = $this->query->execute()->fetchAll();
$data = FetchModeHelper::keyPair($data);
$data = $this->query->execute()->fetchAll(FetchMode::COLUMN);

$this->offset += \count($data);
$this->query->setFirstResult($this->offset);
Expand Down
25 changes: 25 additions & 0 deletions Migration/Migration1565007156RemoveAutoIncrement.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php declare(strict_types=1);

namespace Shopware\Core\Migration;

use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\Migration\MigrationStep;

class Migration1565007156RemoveAutoIncrement extends MigrationStep
{
public function getCreationTimestamp(): int
{
return 1565007156;
}

public function update(Connection $connection): void
{
// implement update
}

public function updateDestructive(Connection $connection): void
{
$connection->executeUpdate('ALTER TABLE product DROP COLUMN auto_increment');
$connection->executeUpdate('ALTER TABLE category DROP COLUMN auto_increment');
}
}

0 comments on commit 49941c6

Please sign in to comment.