38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
namespace ProVM\Database;
|
|
|
|
use Psr\Container\ContainerInterface;
|
|
use ProVM\Concept\Database\QueryBuilder as QBInterface;
|
|
use ProVM\Concept\Database\Query\{Delete,Insert,Select,Update};
|
|
|
|
class QueryBuilder implements QBInterface
|
|
{
|
|
protected ContainerInterface $container;
|
|
public function setContainer(ContainerInterface $container): QBInterface
|
|
{
|
|
$this->container = $container;
|
|
return $this;
|
|
}
|
|
public function getContainer(): ContainerInterface
|
|
{
|
|
return $this->container;
|
|
}
|
|
|
|
public function select(array $columns = ['*']): Select
|
|
{
|
|
return $this->getContainer()->get(Select::class)->select($columns);
|
|
}
|
|
public function insert(string $table): Insert
|
|
{
|
|
return $this->getContainer()->get(Insert::class)->into($table);
|
|
}
|
|
public function update(string $table): Update
|
|
{
|
|
return $this->getContainer()->get(Update::class)->table($table);
|
|
}
|
|
public function delete(string $table): Delete
|
|
{
|
|
return $this->getContainer()->get(Delete::class)->from($table);
|
|
}
|
|
}
|