[Semantical Error] line 0, col 61 near 't WHERE t.id': Error: Class AppBundle\Entity\Comment has no association named thread
using foscomment bundle bt nothing getting on screen...500 internal error in jquery at console plz help me
any one plz help me
stack trash
[1] Doctrine\ORM\Query\QueryException: [Semantical Error] line 0, col 61 near 't WHERE t.id': Error: Class AppBundle\Entity\Comment has no association named thread at n/a in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\QueryException.php line 63
at Doctrine\ORM\Query\QueryException::semanticalError('line 0, col 61 near 't WHERE t.id': Error: Class AppBundle\Entity\Comment has no association named thread', object(QueryException))
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 483
at Doctrine\ORM\Query\Parser->semanticalError('Class AppBundle\Entity\Comment has no association named thread')
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 1042
at Doctrine\ORM\Query\Parser->JoinAssociationPathExpression()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 1688
at Doctrine\ORM\Query\Parser->JoinAssociationDeclaration()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 1628
at Doctrine\ORM\Query\Parser->Join()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 1558
at Doctrine\ORM\Query\Parser->IdentificationVariableDeclaration()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 1286
at Doctrine\ORM\Query\Parser->FromClause()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 874
at Doctrine\ORM\Query\Parser->SelectStatement()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 843
at Doctrine\ORM\Query\Parser->QueryLanguage()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 268
at Doctrine\ORM\Query\Parser->getAST()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 351
at Doctrine\ORM\Query\Parser->parse()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query.php line 255
at Doctrine\ORM\Query->_parse()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query.php line 267
at Doctrine\ORM\Query->_doExecute()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\AbstractQuery.php line 794
at Doctrine\ORM\AbstractQuery->execute()
in C:\wamp\www\Symfony\MySymPro\vendor\friendsofsymfony\comment-bundle\FOS\CommentBundle\Entity\CommentManager.php line 85
at FOS\CommentBundle\Entity\CommentManager->findCommentsByThread(object(Thread), null)
in C:\wamp\www\Symfony\MySymPro\vendor\friendsofsymfony\comment-bundle\FOS\CommentBundle\Model\CommentManager.php line 77
at FOS\CommentBundle\Model\CommentManager->findCommentTreeByThread(object(Thread), null, null)
in C:\wamp\www\Symfony\MySymPro\vendor\friendsofsymfony\comment-bundle\FOS\CommentBundle\Controller\ThreadController.php line 438
at FOS\CommentBundle\Controller\ThreadController->getThreadCommentsAction(object(Request), 'foo')
in line
at call_user_func_array(array(object(ThreadController), 'getThreadCommentsAction'), array(object(Request), 'foo'))
in C:\wamp\www\Symfony\MySymPro\app\bootstrap.php.cache line 3148
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in C:\wamp\www\Symfony\MySymPro\app\bootstrap.php.cache line 3107
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in C:\wamp\www\Symfony\MySymPro\app\bootstrap.php.cache line 3261
at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
in C:\wamp\www\Symfony\MySymPro\app\bootstrap.php.cache line 2490
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in C:\wamp\www\Symfony\MySymPro\web\app_dev.php line 29
[2] Doctrine\ORM\Query\QueryException: SELECT c FROM AppBundle\Entity\Comment c INNER JOIN c.thread t WHERE t.id = :thread ORDER BY c.ancestors ASC at n/a in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\QueryException.php line 41
at Doctrine\ORM\Query\QueryException::dqlError('SELECT c FROM AppBundle\Entity\Comment c INNER JOIN c.thread t WHERE t.id = :thread ORDER BY c.ancestors ASC')
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 483
at Doctrine\ORM\Query\Parser->semanticalError('Class AppBundle\Entity\Comment has no association named thread')
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 1042
at Doctrine\ORM\Query\Parser->JoinAssociationPathExpression()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 1688
at Doctrine\ORM\Query\Parser->JoinAssociationDeclaration()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 1628
at Doctrine\ORM\Query\Parser->Join()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 1558
at Doctrine\ORM\Query\Parser->IdentificationVariableDeclaration()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 1286
at Doctrine\ORM\Query\Parser->FromClause()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 874
at Doctrine\ORM\Query\Parser->SelectStatement()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 843
at Doctrine\ORM\Query\Parser->QueryLanguage()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 268
at Doctrine\ORM\Query\Parser->getAST()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php line 351
at Doctrine\ORM\Query\Parser->parse()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query.php line 255
at Doctrine\ORM\Query->_parse()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\Query.php line 267
at Doctrine\ORM\Query->_doExecute()
in C:\wamp\www\Symfony\MySymPro\vendor\doctrine\orm\lib\Doctrine\ORM\AbstractQuery.php line 794
at Doctrine\ORM\AbstractQuery->execute()
in C:\wamp\www\Symfony\MySymPro\vendor\friendsofsymfony\comment-bundle\FOS\CommentBundle\Entity\CommentManager.php line 85
at FOS\CommentBundle\Entity\CommentManager->findCommentsByThread(object(Thread), null)
in C:\wamp\www\Symfony\MySymPro\vendor\friendsofsymfony\comment-bundle\FOS\CommentBundle\Model\CommentManager.php line 77
at FOS\CommentBundle\Model\CommentManager->findCommentTreeByThread(object(Thread), null, null)
in C:\wamp\www\Symfony\MySymPro\vendor\friendsofsymfony\comment-bundle\FOS\CommentBundle\Controller\ThreadController.php line 438
at FOS\CommentBundle\Controller\ThreadController->getThreadCommentsAction(object(Request), 'foo')
in line
at call_user_func_array(array(object(ThreadController), 'getThreadCommentsAction'), array(object(Request), 'foo'))
in C:\wamp\www\Symfony\MySymPro\app\bootstrap.php.cache line 3148
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in C:\wamp\www\Symfony\MySymPro\app\bootstrap.php.cache line 3107
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in C:\wamp\www\Symfony\MySymPro\app\bootstrap.php.cache line 3261
at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
in C:\wamp\www\Symfony\MySymPro\app\bootstrap.php.cache line 2490
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in C:\wamp\www\Symfony\MySymPro\web\app_dev.php line 29
@stof plz help
Well, Doctrine tells us that there is no association named thread in your Comment entity.
this makes me think that you haven't followed the doc in https://github.com/FriendsOfSymfony/FOSCommentBundle/blob/master/Resources/doc/2a-mapping_orm.md
dear @stof i followed every steps ! but i cant see thread attributes in my comment table ...is it necessary?
author = $author; } public function getAuthor() { return $this->author; } public function getAuthorName() { if (null === $this->getAuthor()) { return 'Anonymous'; } return $this->getAuthor()->getUsername(); } }
i have all the entity configuration in xml ....all i am doine to generate comment entity is run command generate:doctrine:entity in xml with field thread and edit the comment entity same as provide in documentation.
if i dont create xml configured entity with field thread through cmdline then it cant generate table with thread attribute @stof are you sure there is problem with comment entity?
Config.yml
imports: - { resource: parameters.yml } - { resource: security.yml } - { resource: services.yml }
easy_admin: entities: # - AppBundle\Entity\Tbladmin # - AppBundle\Entity\Tblactivities - AppBundle\Entity\User
fos_comment: db_driver: orm class: model: comment: AppBundle\Entity\Comment thread: AppBundle\Entity\Thread
assetic:
bundles: [ "FOSCommentBundle" ]
fos_user:
registration:
confirmation:
enabled: true
from_email:
address: [email protected]
sender_name: Demo registration
resetting:
email:
from_email:
address: [email protected]
sender_name: Demo Resetting
service:
mailer: fos_user.mailer.twig_swift
# registration:
# form:
# type: AppBundle\Form\RegistrationType
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: AppBundle\Entity\User
Put parameters here that don't need to change on each machine where the app is deployed
https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters: locale: en
framework: #esi: ~ translator: ~ secret: '%secret%' router: resource: '%kernel.root_dir%/config/routing.yml' strict_requirements: ~ form: ~ csrf_protection: ~ validation: { enable_annotations: true } #serializer: { enable_annotations: true } templating: engines: ['twig'] default_locale: '%locale%' trusted_hosts: ~ trusted_proxies: ~ session: # handler_id set to null will use default session handler from php.ini handler_id: ~ fragments: ~ http_method_override: true
Twig Configuration
twig: debug: '%kernel.debug%' strict_variables: '%kernel.debug%'
Assetic Configuration
assetic: debug: '%kernel.debug%' use_controller: false bundles: ["FOSCommentBundle"] #java: /usr/bin/java filters: cssrewrite: ~ #closure: # jar: '%kernel.root_dir%/Resources/java/compiler.jar' #yui_css: # jar: '%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar'
Doctrine Configuration
doctrine: dbal: driver: pdo_mysql host: 127.0.0.1 port: null dbname: webfile user: root password: null charset: UTF8 # if using pdo_sqlite as your database driver: # 1. add the path in parameters.yml # e.g. database_path: '%kernel.root_dir%/data/data.db3' # 2. Uncomment database_path in parameters.yml.dist # 3. Uncomment next line: #path: '%database_path%'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
Swiftmailer Configuration
swiftmailer: transport: "%mailer_transport%" host: "%mailer_host%" username: "%mailer_user%" password: "%mailer_password%" spool: { type: memory }
composer.json
{ "name": "symfony/framework-standard-edition", "license": "MIT", "type": "project", "description": "The "Symfony Standard Edition" distribution", "autoload": { "psr-4": { "": "src/"
}
},
"autoload-dev": {
"files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
},
"require": {
"php": ">=5.3.9",
"doctrine/doctrine-bundle": "~1.4",
"doctrine/orm": "^2.4.8",
"friendsofsymfony/user-bundle": "~1.3",
"incenteev/composer-parameter-handler": "~2.0",
"javiereguiluz/easyadmin-bundle": "^1.16",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"symfony/assetic-bundle": "~2.3",
"symfony/monolog-bundle": "^3.0.2",
"symfony/swiftmailer-bundle": "~2.3,>=2.3.10",
"symfony/symfony": "2.7.*",
"twig/twig": "^1.0||^2.0"
},
"require-dev": {
"sensio/generator-bundle": "~2.3",
"symfony/phpunit-bridge": "~2.7"
},
"scripts": {
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"@symfony-scripts"
],
"post-update-cmd": [
"@symfony-scripts"
]
},
"config": {
"bin-dir": "bin",
"platform": {
"php": "5.3.9"
},
"sort-packages": true
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.7-dev"
}
}
}
comment.orm.xml
@stof i installed and configure completely but i can't see comment bundle in composer.json file
please help
thanks @merk for replying ...solved it all i had to do is add mapping mannually in comment.orm.xml
</many-to-one>
<many-to-one field="user" target-entity="AppBundle\Entity\User">
</many-to-one>
after replying all comment gone .....why is that happening refreshing page will start from empty coment
I'm sorry nobody actually replied to you 😭 Now I got the same issue and I'm absolutely lost since this thread does not reveal any solutions xD