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

Commenting without a parent comment triggers error #664

Open
jspeedz opened this issue Sep 5, 2018 · 0 comments
Open

Commenting without a parent comment triggers error #664

jspeedz opened this issue Sep 5, 2018 · 0 comments

Comments

@jspeedz
Copy link

jspeedz commented Sep 5, 2018

Hello!

I have an issue where a MySQL query triggers an error. I was wondering if this is a known issue, or something specific to my environment.

It seems like doctrine converts an empty array to null instead of like an empty string like it did before (it has worked before). The getAncestors() method of the entity it is trying to save returns an empty array.

Package versions:

  • symfony/symfony v3.3.18
  • friendsofsymfony/comment-bundle v2.0.14
  • doctrine/annotations v1.6.0
  • doctrine/cache v1.6.2
  • doctrine/collections v1.4.0
  • doctrine/common v2.7.3
  • doctrine/data-fixtures v1.2.2
  • doctrine/dbal v2.7.1
  • doctrine/doctrine-bundle 1.6.8
  • doctrine/doctrine-cache-bundle 1.3.0
  • doctrine/doctrine-migrations-bundle v1.2.1
  • doctrine/inflector v1.2.0
  • doctrine/instantiator 1.1.0
  • doctrine/lexer v1.0.1
  • doctrine/migrations v1.5.0
  • doctrine/orm v2.6.1
  • symfony/assetic-bundle v2.8.2

Edit: I just upgraded the package to 2.2.0 and applied the fix in #662 . I still have the same problem

An exception occurred while executing 'INSERT INTO comment (ancestors, updated_at, edited, thread_id, author_id) VALUES (?, ?, ?, ?, ?)' with params [null, "2018-09-05 16:24:11", 0, 924, 21]:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'ancestors' cannot be null

  at vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:122
  at Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception occurred while executing \'INSERT INTO comment (ancestors, updated_at, edited, thread_id, author_id) VALUES (?, ?, ?, ?, ?)\' with params [null, "2018-09-05 16:24:11", 0, 924, 21]:SQLSTATE[23000]: Integrity constraint violation: 1048 Column \'ancestors\' cannot be null', object(PDOException))
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:184)
  at Doctrine\DBAL\DBALException::wrapException(object(Driver), object(PDOException), 'An exception occurred while executing \'INSERT INTO comment (ancestors, updated_at, edited, thread_id, author_id) VALUES (?, ?, ?, ?, ?)\' with params [null, "2018-09-05 16:24:11", 0, 924, 21]:SQLSTATE[23000]: Integrity constraint violation: 1048 Column \'ancestors\' cannot be null')
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:158)
  at Doctrine\DBAL\DBALException::driverExceptionDuringQuery(object(Driver), object(PDOException), 'INSERT INTO comment (ancestors, updated_at, edited, thread_id, author_id) VALUES (?, ?, ?, ?, ?)', array(null, '2018-09-05 16:24:11', 0, 924, 21))
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php:178)
  at Doctrine\DBAL\Statement->execute()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:285)
  at Doctrine\ORM\Persisters\Entity\BasicEntityPersister->executeInserts()
     (vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:1073)
  at Doctrine\ORM\UnitOfWork->executeInserts(object(ClassMetadata))
     (vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:386)
  at Doctrine\ORM\UnitOfWork->commit(null)
     (vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:358)
  at Doctrine\ORM\EntityManager->flush(null)
     (var/cache/dev/appDevDebugProjectContainer.php:11596)
  at DoctrineORMEntityManager_000000003e86af43000000004aafd962cdb39e43f97aef6f90a953c3441a8f88->flush()
     (vendor/friendsofsymfony/comment-bundle/FOS/CommentBundle/Entity/CommentManager.php:128)
  at FOS\CommentBundle\Entity\CommentManager->doSaveComment(object(Comment))
     (vendor/friendsofsymfony/comment-bundle/FOS/CommentBundle/Model/CommentManager.php:136)
  at FOS\CommentBundle\Model\CommentManager->saveComment(object(Comment))
     (vendor/friendsofsymfony/comment-bundle/FOS/CommentBundle/Acl/AclCommentManager.php:133)
  at FOS\CommentBundle\Acl\AclCommentManager->saveComment(object(Comment))
     (vendor/friendsofsymfony/comment-bundle/FOS/CommentBundle/Controller/ThreadController.php:495)
  at FOS\CommentBundle\Controller\ThreadController->postThreadCommentsAction(object(Request), '924')
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:169)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (web/app_dev.php:31)
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

No branches or pull requests

1 participant