executeCacheQuery第一个参数是否需要Statement和字符串?

时间:2018-10-10 18:13:18

标签: php caching doctrine-orm doctrine-dbal

使用

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class MainCode : MonoBehaviour {

    public Text moneyAmount;

    public float mps = 0;
    public float mpc = 1;
    public float money = 0;
    public string stageName;

    // Use this for initialization
    void Start()
    {
        moneyAmount.text = "$" + money;

    }

    // Update is called once per frame
    void Update()
    {
        moneyAmount.text = "$" + money;
    }

    public void MoneyClickChange()
    {
        money = money + mpc;
        return;
    }
}

这是令人讨厌的代码部分:

doctrine/common                 v2.9.0
doctrine/dbal                   v2.8.0

我不确定确切要作为$qb = $db->createQueryBuilder() ->select(...) ->from(...) ->leftJoin(...) ->where(...) ->orderBy(...) ->setMaxResults(1) ->setParameter('forum_id', ANNOUNCEMENT_FORUM_ID ?? 3); $query = $db->executeCacheQuery($qb->execute(), $qb->getParameters(), $qb->getParameterTypes(), new \Doctrine\DBAL\Cache\QueryCacheProfile(60, 'announcement', null)); $announcement = $query->fetch(); dump($announcement); 的第一个参数传递什么,因为如果我在其中放置$db->executeCacheQuery(),因为它希望我传递一条语句,则会出现此错误:

$qb->execute()

Recoverable fatal error: Object of class PDOStatement could not be converted to string in ...../vendor/doctrine/dbal/lib/Doctrine/DBAL/Cache/QueryCacheProfile.php on line 102 类中的哪一部分?

enter image description here

当我改用QueryCacheProfile(这是一个字符串)时,出现此错误:

$qb->getSQL()

这是我关注的文档示例:https://www.doctrine-project.org/projects/doctrine-dbal/en/2.8/reference/caching.html#caching

如何管理此查询?

0 个答案:

没有答案