odiseoteam / SyliusBlogPlugin

This plugin add blog capabilities to your Sylius project.
MIT License
34 stars 18 forks source link

Removing comment also removes article associated with it #11

Closed LaRamenNoodles closed 4 years ago

LaRamenNoodles commented 4 years ago

While exploring plugin I've found bug that when I remove the comment from article then the article itself is also being removed.

I've found out that it's because of this yml code block:

 manyToOne:
    article:
        targetEntity: Odiseo\BlogBundle\Model\ArticleInterface
        inversedBy: comments
        cascade: [ALL]
        joinColumn:
            name: article_id
            referencedColumnName: id
            onDelete: CASCADE

The bug caused by this cascade: cascade: [ALL] and if it's changed to cascade: [persist] then everything works fine.

This is the file and the line vendor/odiseoteam/blog-bundle/src/Resources/config/doctrine/model/ArticleComment.orm.yml:38

bigboss86 commented 4 years ago

Hi @zlotte, it's already fixed. Thanks for the contribution.