Skip to content

Conversation

@loic425
Copy link
Member

@loic425 loic425 commented Feb 26, 2018

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets fixes #8172
License MIT

<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/services/constraint-mapping-1.0.xsd">
<class name="Sylius\Component\Review\Model\Review">
<property name="title">
<constraint name="NotBlank">
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this constraint be removed now?

Copy link
Member Author

@loic425 loic425 Feb 26, 2018

Choose a reason for hiding this comment

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

I don't think so. IMHO, when you write a commented review, you need a title and a comment. When you have a "rating system" by only clicking on stars for example, title is not required.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it work like that now (title is required if comment is filled)? I guess we'd need some Behat scenario to cover that.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I just kept existing behaviour on sylius core :)
We can go further but it's more complex. For exemple, you need to separate ratings from commented reviews on frontend. Moreover, the status workflow is different. A single rate doesn't need to be accepted.

Copy link
Member Author

@loic425 loic425 Feb 26, 2018

Choose a reason for hiding this comment

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

@pamil I think it's just a first step. It's just an improvment for sylius review bundle and an easier way to improve/customize sylius review behaviour in a sylius shop.

Copy link
Member Author

@loic425 loic425 Feb 28, 2018

Choose a reason for hiding this comment

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

@Zales0123 @pamil @pjedrzejewski @lchrusciel
Could you think about that, discuss this and tell me what do you think about the best behaviour I could implement.

Currently, with existing Pull request, I added a new validation group (sylius_review) on title to allow using only "sylius" validation group to remove not blank validation on title. Another solution could be the idea suggested by Pamil: title is required only if comment is filled. I guess it needs a form listener to do that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Any idea?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry @loic425 for the long response. I thing that requiring comment only if title is filled is the best approach, just seems as the most natural solution. /cc @pamil @pjedrzejewski @lchrusciel

Copy link
Member Author

Choose a reason for hiding this comment

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

@Zales0123 Ok, I'm gonna work on that approach.

@pamil pamil added Feature New feature proposals. Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). labels Feb 26, 2018
@pamil pamil added this to the 1.2 milestone Feb 26, 2018
Copy link
Contributor

@lchrusciel lchrusciel left a comment

Choose a reason for hiding this comment

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

I'm ok with the current implementation, but IMHO the simplest removal of this constraint will work totally fine.

Copy link
Contributor

@pamil pamil left a comment

Choose a reason for hiding this comment

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

I think we can merge this one and providing a conditional validation (title required if there's a comment) would be the next step then.

@pamil pamil merged commit 84e0818 into Sylius:master Mar 8, 2018
@pamil
Copy link
Contributor

pamil commented Mar 8, 2018

Thanks Loic! 🥇

@pamil
Copy link
Contributor

pamil commented Mar 8, 2018

I've created #9239 to track that conditional validation feature.

@loic425 loic425 deleted the feature/review/nullable-title branch April 7, 2018 07:10
pamil added a commit to pamil/Sylius that referenced this pull request May 7, 2019
…itle

[Reviews] nullable title for reviews
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). Feature New feature proposals.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Review] Why title is required ?

4 participants