Zend Framework Doctrine \ DBAL \ Exception \ InvalidFieldNameException

时间:2017-04-02 10:49:08

标签: php symfony zend-framework doctrine-orm

我有这个问题,因为我已将我的网站移动到其他服务器。配置是一样的,任何提示?

文件:

/var/www/page/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:71

消息:

An exception occurred while executing 'SELECT s0_.id AS id_0, s0_.answer AS answer_1, s0_.users_usrId AS users_usrId_2, s0_.question AS question_3 FROM secret_answer s0_ WHERE s0_.users_usrId = ?' with params [83440]:

SQLSTATE [42S22]:找不到列:1054'字段列表'中的未知列's0_.users_usrId'

堆栈追踪:

#0 /var/www/page/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(128): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))
#1 /var/www/page/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(855): Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException), 'SELECT s0_.id A...', Array)
#2 /var/www/page/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Exec/SingleSelectExecutor.php(50): Doctrine\DBAL\Connection->executeQuery('SELECT s0_.id A...', Array, Array, NULL)
#3 /var/www/page/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php(321): Doctrine\ORM\Query\Exec\SingleSelectExecutor->execute(Object(Doctrine\DBAL\Connection), Array, Array)
#4 /var/www/page/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(969): Doctrine\ORM\Query->_doExecute()
#5 /var/www/page/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(924): Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache(NULL, NULL)
#6 /var/www/page/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php(766): Doctrine\ORM\AbstractQuery->execute(NULL, NULL)
#7 /var/www/page/vendor/custom/p-server-core/src/PServerCore/Entity/Repository/SecretAnswer.php(23): Doctrine\ORM\AbstractQuery->getOneOrNullResult()
#8 /var/www/page/vendor/custom/p-server-core/src/PServerCore/Form/Password.php(85): PServerCore\Entity\Repository\SecretAnswer->getAnswer4UserId(83440)
#9 /var/www/page/vendor/custom/p-server-core/src/PServerCore/Controller/AuthController.php(188): PServerCore\Form\Password->addSecretQuestion(Object(DoctrineORMModule\Proxy\__CG__\PServerCore\Entity\User))
#10 /var/www/page/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(78): PServerCore\Controller\AuthController->pwLostConfirmAction()
#11 /var/www/page/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#12 /var/www/page/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#13 /var/www/page/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(105): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#14 /var/www/page/vendor/zendframework/zend-mvc/src/DispatchListener.php(119): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#15 /var/www/page/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#16 /var/www/page/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#17 /var/www/page/vendor/zendframework/zend-mvc/src/Application.php(332): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#18 /var/www/page/public/index.php(18): Zend\Mvc\Application->run()
#19 {main}

谢谢和亲切的问候。

1 个答案:

答案 0 :(得分:0)

看起来该字段缺失。您可能必须更新数据库架构或调整实体的orm配置。

假设您使用注释,您可以在@Table中指定表名,并在@Column注释中指定字段名称。确保实体映射到右表,将属性映射到右侧字段。