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

[CoreBundle] Add custom constraint for "enabled" entity fields and prevent delete all channels #3150

Merged
merged 14 commits into from
Sep 4, 2015
Merged

Conversation

gperdomor
Copy link
Contributor

Q A
Bug fix? yes
New feature? yes
BC breaks? no
Deprecations? no
Fixed tickets #3135
License MIT
Doc PR -

This PR introduce a custom constraint to verify entities with enabled field, when at least one entity is required to be enabled.

Also this PR prevent the deletion of a channel, if the the channel is the unique enabled channel available.

@gperdomor gperdomor changed the title Feature/fix 3135 [CoreBundle] Add custom constraint for "enabled" entity fields and prevent delete all channels Aug 18, 2015
@pjedrzejewski pjedrzejewski added this to the v0.15.0 milestone Aug 18, 2015
/*
* @author Gustavo Perdomo <[email protected]>
*/

Copy link
Member

Choose a reason for hiding this comment

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

Extra blank line.

@gperdomor
Copy link
Contributor Author

ping @pjedrzejewski

@gperdomor
Copy link
Contributor Author

pong @pjedrzejewski xD

@pjedrzejewski
Copy link
Member

@gperdomor Ping pong. :) I will have a look at this PR as soon as humanly possible. :) I need to give it a bit more thought and we are at PHP Summer Camp right now, things are busy. :) Thanks for your patience!

*/
class ChannelListener
{
private $repository;
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing docblock.

return $entityManager;
}

private function ensureEntityHasProvidedEnabledField($entity, Constraint $constraint, ObjectManager $entityManager)
Copy link
Member

Choose a reason for hiding this comment

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

Missing docblock.

Copy link
Contributor

Choose a reason for hiding this comment

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

Missin docblock, anyway it would be nice to replace Constraint $constraint with $enabledPropertyPath. If so, I would recommend given order ObjectManager $objectManager, $object, $enabledPropertyPath.

Copy link
Member

Choose a reason for hiding this comment

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

👍

@pamil
Copy link
Contributor

pamil commented Sep 3, 2015

There are some specs and Behat scenarios missing.

@gperdomor
Copy link
Contributor Author

Behat scenarios are failing when run the channel_management.feature, i get Notice: Undefined index: calculator in src/Sylius/Bundle/PaymentBundle/Behat/PaymentContext.php line 35.

What should i do in this case?

@pamil
Copy link
Contributor

pamil commented Sep 4, 2015

@gperdomor I fixed it in #3177, it will be merged today (I think rather in the morning than in the evening :)).

@pamil
Copy link
Contributor

pamil commented Sep 4, 2015

@gperdomor already merged, you can rebase :)

pjedrzejewski pushed a commit that referenced this pull request Sep 4, 2015
[CoreBundle] Add custom constraint for "enabled" entity fields and prevent delete all channels
@pjedrzejewski pjedrzejewski merged commit 0e58332 into Sylius:master Sep 4, 2015
@pjedrzejewski
Copy link
Member

Thanks a lot @gperdomor and guys for the review! 👍 Good job.

@gperdomor gperdomor deleted the feature/fix-3135 branch December 17, 2015 18:22
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.

6 participants