for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Smoren\QueryRelationManager\Yii2;
use Smoren\QueryRelationManager\Base\QueryWrapperInterface;
use yii\db\Connection;
use yii\db\Query;
/**
* ActiveQuery wrapper implementation for QueryRelationManager
* @author Smoren <[email protected]>
* @inheritDoc
*/
class QueryWrapper implements QueryWrapperInterface
{
* ActiveQuery instance
* @var Query
protected Query $query;
* QueryWrapper constructor
public function __construct()
$this->query = new Query();
}
public function select(array $arSelect): QueryWrapperInterface
$this->query->select($arSelect);
return $this;
public function from(array $mapFrom): QueryWrapperInterface
$this->query->from($mapFrom);
public function join(
string $type,
array $mapTable,
string $condition,
array $extraJoinParams = []
): QueryWrapperInterface {
$this->query->join("{$type} join", $mapTable, $condition, $extraJoinParams);
* @param Connection|null $db DB connection instance
public function all($db = null): array
return $this->query->all($db);
public function getRawSql(): string
return $this->query->createCommand()->getRawSql();
* @return Query
public function getQuery(): Query
return $this->query;