Skip to content

[WIP] SyliusReviewBundle#2

Closed
Zales0123 wants to merge 40 commits intomasterfrom
sylius-review-bundle
Closed

[WIP] SyliusReviewBundle#2
Zales0123 wants to merge 40 commits intomasterfrom
sylius-review-bundle

Conversation

@Zales0123
Copy link
Copy Markdown
Owner

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Fixed tickets
License MIT
Doc PR in progress

Initial implementation of SyliusReviewBundle, which allows to easily manage review system. It's based on Sylius#431. "Reviewable" and "Reviewer" classes can be configured under sylius_review tag:

sylius_review:
    classes:
        product:
            subject: Sylius\Component\Core\Model\Product
            review:
                model: Sylius\Component\Product\Model\ProductReview
                form:
                    default: Sylius\Bundle\ProductBundle\Form\Type\ProductReviewType
                    admin: Sylius\Bundle\CoreBundle\Form\Type\ProductReviewAdminType
            reviewer:
                model: Sylius\Component\Core\Model\Customer

Reviews can be written by customers and guests on the product page. Newly created review has state new and can be confirmed or rejected by administrator. After confirming, it's product has average rating calculated. There are 3 possible behaviors while review creation:

  • if customer is logged in, it's automatically assigned as review author
  • if customer is not logged in, email must be provided and new customer is created based on it
  • if provided email is already used, "please, log in" message is displayed

Reviews can be also created in administration panel, with choosing product and author.

There are still some things that have to be changed to make it working perfectly:

  • change ProductReviewType to use CustomerGuestType or some similar UserBundle form type: for now there is custom transformer and listener, cause existing CustomerGuestType doesn't exactly fit ReviewBundle needs - they would probably removed after fixing this point
  • consider how review author should be displayed on reviews list:
  • think about CustomerDeleteListener: currently every review of deleted customer is deleted as well, but I think there should have author field changed to "deleted user" or sth like this - I would appreciate any ideas about implementation
  • work on translations, cause I'm sure not everything is translated for now

Some ideas for future improvements:

  • send notification email to review author after accepting/rejecting his review
  • add possibility to send reason, why review was rejected
  • add proper info label to review if authored by user, that have already bought reviewed subject

I will be thankful for some review, cause I'm pretty sure there are some part when my code can be improved ;)

@Zales0123 Zales0123 force-pushed the sylius-review-bundle branch from 5b2574c to 1c32321 Compare August 21, 2015 18:45
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There should be space instead of _, it's business scenario :)

…ces-in-taxation

[Taxation] Remove fluent interfaces
…es-remove

[Promotion] Remove all fluent interfaces
…e-context

[Core] Delete commented line in CoreContext
@Zales0123 Zales0123 closed this Sep 29, 2015
Zales0123 pushed a commit that referenced this pull request Nov 20, 2015
Zales0123 added a commit that referenced this pull request Feb 7, 2017
Zales0123 added a commit that referenced this pull request Feb 7, 2017
Zales0123 pushed a commit that referenced this pull request Mar 9, 2017
[Behat] Fix pricing-related validation message assertions
Zales0123 pushed a commit that referenced this pull request Aug 1, 2017
Uncaught Symfony\Component\Debug\Exception\ContextErrorException: Warning: Cannot bind closure to scope of internal class ReflectionProperty in /Users/pamil/Projects/Sylius/Sylius/var/cache/test/appTestProjectContainer.php:28784
Stack trace:
#0 [internal function]: SyliusBundleChannelBundleDoctrineORMChannelRepository_000000004a4ae55b000000001fee2e9bc41b18016a7f6458d1a51d748b49311b->__set('_entityName', NULL)
#1 /Users/pamil/Projects/Sylius/Sylius/app/TestAppKernel.php(72): ReflectionProperty->setValue(Object(SyliusBundleChannelBundleDoctrineORMChannelRepository_000000004a4ae55b000000001fee2e9bc41b18016a7f6458d1a51d748b49311b), NULL)
#2 /Users/pamil/Projects/Sylius/Sylius/app/TestAppKernel.php(41): TestAppKernel->cleanupContainer(Object(appTestProjectContainer))
#3 /Users/pamil/Projects/Sylius/Sylius/vendor/lakion/api-test-case/src/ApiTestCase.php(85): TestAppKernel->shutdown()
#4 /Users/pamil/Projects/Sylius/Sylius/vendor/phpunit/phpunit/src/Framework/TestSuite.php(727): Lakion\ApiTestCase\ApiTestCase::ensur in /Users/pamil/Projects/Sylius/Sylius/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php on line 99
Zales0123 added a commit that referenced this pull request Mar 6, 2019
- desc #1
- desc #2
Zales0123 pushed a commit that referenced this pull request May 13, 2020
This PR was merged into the 1.7 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | 1.7
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | 
| License         | MIT

Should resolve:
```bash
PHP Fatal error:  Uncaught Psalm\Exception\TypeParseTreeException: Unterminated bracket in /home/travis/build/Sylius/Sylius/vendor/vimeo/psalm/src/Psalm/Internal/Type/ParseTree.php:571
Stack trace:
#0 /home/travis/build/Sylius/Sylius/vendor/vimeo/psalm/src/Psalm/Type.php(171): Psalm\Internal\Type\ParseTree::createFromTokens(Array)
#1 /home/travis/build/Sylius/Sylius/vendor/vimeo/psalm/src/Psalm/Internal/Visitor/ReflectorVisitor.php(2668): Psalm\Type::parseTokens(Array)
#2 /home/travis/build/Sylius/Sylius/vendor/vimeo/psalm/src/Psalm/Internal/Visitor/ReflectorVisitor.php(2207): Psalm\Internal\Visitor\ReflectorVisitor->getAssertionParts('array<array-key...', Object(PhpParser\Node\Stmt\Function_))
#3 /home/travis/build/Sylius/Sylius/vendor/vimeo/psalm/src/Psalm/Internal/Visitor/ReflectorVisitor.php(323): Psalm\Internal\Visitor\ReflectorVisitor->registerFunctionLike(Object(PhpParser\Node\Stmt\Function_))
#4 /home/travis/build/Sylius/Sylius/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(200): Psalm\Internal\Visitor\Reflect in /home/travis/build/Sylius/Sylius/vendor/vimeo/psalm/src/Psalm/Internal/Type/ParseTree.php on line 571
Fatal error: Uncaught Psalm\Exception\TypeParseTreeException: Unterminated bracket in /home/travis/build/Sylius/Sylius/vendor/vimeo/psalm/src/Psalm/Internal/Type/ParseTree.php:571
Stack trace:
#0 /home/travis/build/Sylius/Sylius/vendor/vimeo/psalm/src/Psalm/Type.php(171): Psalm\Internal\Type\ParseTree::createFromTokens(Array)
#1 /home/travis/build/Sylius/Sylius/vendor/vimeo/psalm/src/Psalm/Internal/Visitor/ReflectorVisitor.php(2668): Psalm\Type::parseTokens(Array)
#2 /home/travis/build/Sylius/Sylius/vendor/vimeo/psalm/src/Psalm/Internal/Visitor/ReflectorVisitor.php(2207): Psalm\Internal\Visitor\ReflectorVisitor->getAssertionParts('array<array-key...', Object(PhpParser\Node\Stmt\Function_))
#3 /home/travis/build/Sylius/Sylius/vendor/vimeo/psalm/src/Psalm/Internal/Visitor/ReflectorVisitor.php(323): Psalm\Internal\Visitor\ReflectorVisitor->registerFunctionLike(Object(PhpParser\Node\Stmt\Function_))
#4 /home/travis/build/Sylius/Sylius/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(200): Psalm\Internal\Visitor\Reflect in /home/travis/build/Sylius/Sylius/vendor/vimeo/psalm/src/Psalm/Internal/Type/ParseTree.php on line 571
```

Ref. https://travis-ci.org/github/Sylius/Sylius/jobs/682877325
Ref. amphp/amp#314

<!--
 - Bug fixes must be submitted against the 1.6 or 1.7 branches (the lowest possible)
 - Features and deprecations must be submitted against the master branch
 - Make sure that the correct base branch is set
-->


Commits
-------

f6819a2 [Maintenance] Upgrade psalm version
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.

7 participants