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

Throw exception if sequence generator not found #1500

Merged
merged 3 commits into from
May 15, 2014

Conversation

umpirsky
Copy link
Contributor

No description provided.

@umpirsky umpirsky mentioned this pull request May 14, 2014

continue;
}
$generator = $this->registry->get($entity);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would actually catch the generic exception and throw a sequence-specific one, easier to debug and control.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know. I was lazy 👅

@winzou
Copy link
Contributor

winzou commented May 14, 2014

That's efficiency!

@@ -29,7 +29,7 @@ public function getId();
public function getName();

/**
* @param string $name
* @param string $name
Copy link
Contributor

Choose a reason for hiding this comment

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

I see you run CS fixer... and again it fails with such changes =)

Correct one is new line between @param & @return.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep :)

{
public function __construct($entity, NonExistingServiceException $e)
{
parent::__construct(sprintf('Generator for entity "%s" does not exist.', get_class($entity)), 0, $e);
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 be even clearer in the exception message:

... You must add it in your sylius.yml configuration file. For example: sylius_sequence.generators.%s: sylius.sequence.sequential_number_generator

And replace the 0 by $e->getCode() ;)

pjedrzejewski pushed a commit that referenced this pull request May 15, 2014
Throw exception if sequence generator not found
@pjedrzejewski pjedrzejewski merged commit f194c78 into Sylius:master May 15, 2014
@pjedrzejewski
Copy link
Member

That was buggin me as well, thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants