当我建立一个查询时,学说自动删除了“()”。
这是我的查询:
$query = MstFontTable::getInstance()->createQuery('msf');
$query->where('(full_font_name LIKE ? OR
full_font_name LIKE ? OR
full_font_name LIKE ? OR
full_font_name = ? OR
font_name = ?)', array(trim($fontName) . ',%',
'%,' . trim($fontName),
'%,' . trim($fontName) . ',%',
trim($fontName),
trim($fontName)
)
);
$query->andWhere('((tenant_id = 0 OR tenant_id = ?))', array(intval($tenantId)));
这是我使用 $query->getDql() 时的结果:
FROM MstFont msf WHERE (full_font_name LIKE ? OR
full_font_name LIKE ? OR
full_font_name LIKE ? OR
full_font_name = ? OR
font_name = ?) AND ((tenant_id = 0 OR tenant_id = ?))
这是我使用 $query->getSqlQuery() 时的结果:
SELECT m.font_id AS m__font_id, m.tenant_id AS m__tenant_id, m.font_name AS m__font_name, m.font_file AS m__font_file, m.font_category AS m__font_category, m.vendor AS m__vendor, m.full_font_name AS m__full_font_name, m.font_name_ap AS m__font_name_ap FROM mst_font m WHERE (m.full_font_name LIKE ? OR
full_font_name LIKE ? OR
full_font_name LIKE ? OR
full_font_name = ? OR
font_name = ? AND (m.tenant_id = 0 OR m.tenant_id = ?))
有没有人帮我解释这个问题?