vendor/codeages/biz-framework/src/Dao/DynamicQueryBuilder.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Codeages\Biz\Framework\Dao;
use Doctrine\DBAL\Query\QueryBuilder;
class DynamicQueryBuilder extends QueryBuilder
{
protected $conditions;
public function __construct(Connection $connection, $conditions)
{
parent::__construct($connection);
$this->conditions = $conditions;
}
public function where($where)
{
if (!$this->isWhereInConditions($where)) {
return $this;
}
return parent::where($where);
}
public function andWhere($where)
{
if (!$this->isWhereInConditions($where)) {
return $this;
}
if ($likeType = $this->matchLikeCondition($where)) {
return $this->addWhereLike($where, $likeType);
}
return parent::andWhere($where);
}
public function andStaticWhere($where)
{
return parent::andWhere($where);
}
private function addWhereLike($where, $likeType)
{
$conditionName = $this->getConditionName($where);
//PRE_LIKE
if ('pre_like' == $likeType) {
$where = preg_replace('/pre_like/i', 'LIKE', $where, 1);
$this->conditions[$conditionName] = "{$this->conditions[$conditionName]}%";
} elseif ('suf_like' == $likeType) {
$where = preg_replace('/suf_like/i', 'LIKE', $where, 1);
$this->conditions[$conditionName] = "%{$this->conditions[$conditionName]}";
} else {
$this->conditions[$conditionName] = "%{$this->conditions[$conditionName]}%";
}
return parent::andWhere($where);
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。