Symfony-来自json_数组的createQueryBuilder

Symfony-来自json_数组的createQueryBuilder,symfony,doctrine-orm,doctrine,Symfony,Doctrine Orm,Doctrine,我使用Symfony 4中的自定义查询createQueryBuilder()。 我的实体具有列price\u ranges type=“json\u array” 我将这些数据存储在此列中 { "from": "10.10.2010", "to": "10.20.2010", "pricePerNight": 100, "minStay": 7 } 要按pricePerNight查询数据,请输入price\u ranges列 我创建了函数,但出现以下错误:

我使用Symfony 4中的自定义查询
createQueryBuilder()
。 我的实体具有列
price\u ranges type=“json\u array”

我将这些数据存储在此列中

{
    "from": "10.10.2010", 
    "to": "10.20.2010", 
    "pricePerNight": 100,
    "minStay": 7
}
要按
pricePerNight
查询数据,请输入
price\u ranges

我创建了函数,但出现以下错误:

[Semantical Error] line 0, col 41 near 'price_ranges': Error: Class App\Entity\House has no field or association named price_ranges
这是我的功能。我错在哪里

public function findDataByPriceRange()
    {
        $qb = $this->createQueryBuilder('u');
        $qb->select('u')
            ->where('u.price_ranges LIKE :price_ranges')
            ->setParameter('pricePerNight', 100);
        return $qb->getQuery()->getResult();
    }
编辑我的函数后:

public function findVillasByPriceRange()
{
    $qb = $this->createQueryBuilder('u');
    $qb->select('u')
        ->where('u.priceRanges LIKE :priceRanges')
        ->setParameter('pricePerNight', 100);
    return $qb->getQuery()->getResult();
}
我得到这个错误:

Invalid parameter: token pricePerNight is not defined in the query.

您需要在
where()
setParameter()
中使用相同的参数名,如下所示

->where('u.priceRanges LIKE :parameterName')
->setParameter('parameterName', 100);