php Symfony SQLSTATE[42000]:语法错误或访问冲突:1064在冲洗期间()[关闭]

wnvonmuf  于 12个月前  发布在  PHP
关注(0)|答案(1)|浏览(108)

已关闭此问题为not reproducible or was caused by typos。它目前不接受回答。

此问题是由打印错误或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这一个是解决的方式不太可能帮助未来的读者。
5天前关闭。
Improve this question
我们使用Docker和Symfony 5.6,PHP 8.0,xcaddy v2.7.3和MariaDB 10.3.34与Doctrine。该应用程序分为cron,caddy,node,php,db,db-backup和mailer容器。
当创建任何新实体并尝试将其保存到数据库时,会出现此问题。删除实体工作正常。确切的错误消息是:
执行查询时发生异常:SQLSTATE[42000]:语法错误或访问冲突:1064您的SQL语法有错误;检查与您的MariaDB服务器版本对应的手册,以获得正确的语法来使用near '???????????,?,?)' at line 1 . It's thrown in vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php'?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' at line 1的开头缺少的(对我来说非常有趣,因为普通查询可能看起来更像这样:'INSERT INTO article (id, description, name, deletaed_at) VALUES (?, ?, ?, ?)'唉,我被难倒了,因为我们没有修改flush(),最近也没有任何数据库迁移。我们可以连接到数据库(开发和生活)没有任何障碍,否则(例如,获取数据、删除、PhpStorm视图)。 最新的变化是将xcaddy从2.6.4更新到2.72。在注意到错误后,再次转到2.73,然后转到2.6.4,但它仍然存在。 我不知道这是否相关,但bin/console doctrine:schema:validate没有返回警告或错误。 当使用调试器单步执行该过程时,实体本身与其所有数据一起存在。正确评估字段和值。可以建立到代码中的数据库的连接。 所有其他关于SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ...的帖子似乎都是手写的查询或包含保留的列名,所以我目前看不到任何方法来应用他们的解决方案。如果你能帮忙的话,我将不胜感激。 编辑:6月3日的一个过去的提交可以工作,而docker用那天的数据编写构建与我们当前的主提交一起工作,所以我会继续爬提交,直到它不再工作。 运行composer update`后,

  • vendor/bin/doctrine
  • vendor/bin/doctrine-dbal
  • vendor/bin/doctrine-migrations
  • vendor/bin/path-type-declarations
  • vendor/bin/php-parse
  • vendor/bin/simple-phpunit
  • vendor/bin/var-dump-server
  • vendor/bin/yaml-lint

但每个文件中的唯一更改是从

if (
        (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
        || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
    ) {
        include("phpvfscomposer://" . __DIR__ . '/..'.'/doctrine/orm/bin/doctrine');
        exit(0);
    }
}

include __DIR__ . '/..'.'/doctrine/orm/bin/doctrine';

if (
        (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
        || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
    ) {
        return include("phpvfscomposer://" . __DIR__ . '/..'.'/doctrine/orm/bin/doctrine');
    }
}

return include __DIR__ . '/..'.'/doctrine/orm/bin/doctrine';

编辑:错误发生在许多实体上,但设置通常是这样的。谢谢,我会想办法得到查询

public function addArticle(Request $request): Response
    {
        $data = json_decode($request->getContent(), null, 512, JSON_THROW_ON_ERROR);
        if (!isset($data->id)) {
            throw new BadRequestException('No id was given');
        }
        $masterArticle = $this->masterArticleRepository->find($data->id);
        if (!$masterArticle) {
            throw $this->createNotFoundException();
        }
        $period = $this->getPeriod($request);
        $periodArticle = new PeriodArticle($masterArticle, $period);
        $this->entityManager->persist($periodArticle);
        $this->entityManager->flush();

        return new JsonResponse($this->serializer->normalize($periodArticle, 'json', ['groups' => 'medium']));
    }

编辑:@aynber,@hakre查询是INSERT INTO region_attribute (description, combination, additional_description, internal_note, agency_note, sales_agency_note, do_not_show, active_pictures, promotion_price, special_price, special_description, payback, new_in_assortment, give_away, recommendation, deleted_at, region_id, master_article_id, master_mix_group_id, master_container_id, period_article_id, period_mix_group_id, period_container_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)参数和类型是空数组
编辑:大约在caddy更新的时候,我们也更新了composer.lock。在这方面,有许多关于教义的变化。使用前一天的composer.lock构建应用程序并不是一个干净的解决方案,但它将是我们的解决方案,直到我们找到确切需要更改的内容才能与新版本一起使用。

e4eetjau

e4eetjau1#

问题不是球童,正如已经审查过的那样,而是关于我们的composer.lock中的教义的版本升级,这是一个我们只能自己解决的问题,所以我结束了这个问题。

相关问题