Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Order][Sequence] Remove SequenceBundle and move logic of generating numbers to OrderBundle #5505

Merged
merged 8 commits into from
Jul 21, 2016

Conversation

GSadee
Copy link
Member

@GSadee GSadee commented Jul 13, 2016

Q A
Bug fix? no
New feature? yes
BC breaks? yes
Related tickets
License MIT

@pjedrzejewski pjedrzejewski added the BC Break PRs introducing BC breaks (do not even try to merge). label Jul 13, 2016
/**
* @author Grzegorz Sadowski <grzegorz.sadowski@lakion.com>
*/
class OrderNumberGenerator implements OrderNumberGeneratorInterface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final class SequentialOrderNumberGenerator?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, this class is not only a generator, it is an assigner also. I would suggest to split this logic, and create a generator, which will only generate number and increment a sequence and a second one, which will check if a number generation is require and if so, just call a generate method. Checker could be also extracted, but I'm afraid that it would be an overengineering.

Copy link
Member Author

@GSadee GSadee Jul 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a bad idea 👍
I have extracted OrderNumberAssigner from this generator

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can still rename it to SequentialOrderNumberGenerator :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we can still make it final :)

@GSadee GSadee changed the title [WIP][Order][Sequence] Remove SequenceBundle and move logic to OrderBundle [WIP][Order][Sequence] Remove SequenceBundle and move logic of generating numbers to OrderBundle Jul 13, 2016
@GSadee GSadee force-pushed the remove-sequence branch 3 times, most recently from d086189 to fd65005 Compare July 14, 2016 08:16
@GSadee GSadee changed the title [WIP][Order][Sequence] Remove SequenceBundle and move logic of generating numbers to OrderBundle [Order][Sequence] Remove SequenceBundle and move logic of generating numbers to OrderBundle Jul 14, 2016
$this->addSql('CREATE TABLE sylius_sequence (id INT AUTO_INCREMENT NOT NULL, idx INT NOT NULL, type VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, UNIQUE INDEX UNIQ_AD3D8CC48CDE5729 (type), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('DROP TABLE sylius_order_sequence');
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know is it needed to generate migration, as for now Sylius does not support/use them (and they probably will be added as one enormous migration in the nearest future).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's nothing wrong in generating a migration right now, it may help to jump from 0.19 to 1.0.0-alpha.

<?php

/*
* This file is part of the Sylius package.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:trollface:

@GSadee GSadee force-pushed the remove-sequence branch 4 times, most recently from c908fba to 0c038e9 Compare July 19, 2016 12:11
/**
* @author Grzegorz Sadowski <grzegorz.sadowski@lakion.com>
*/
interface SequentialOrderNumberGeneratorInterface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interface should be SequentialOrderNumberGeneratorInterface, Sequential is specific implementation.

@pjedrzejewski pjedrzejewski merged commit 3204315 into Sylius:master Jul 21, 2016
@pjedrzejewski
Copy link
Member

Thanks Grzesiu, really nice work, please apply @michalmarcinkowski's comment in separate PR. 👍

@GSadee GSadee deleted the remove-sequence branch September 22, 2017 08:32
pamil pushed a commit to pamil/Sylius that referenced this pull request May 7, 2019
[Order][Sequence] Remove SequenceBundle and move logic of generating numbers to OrderBundle
pamil pushed a commit to pamil/Sylius that referenced this pull request May 7, 2019
[Order][Sequence] Remove SequenceBundle and move logic of generating numbers to OrderBundle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BC Break PRs introducing BC breaks (do not even try to merge).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants