db

Catalogue
  1. 1. @设置结果集为 array
  2. 2. @db 操作

@设置结果集为 array

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use Core\Event\EventDispatcherInterface;
use Core\Event\EventEnum;
use Core\Event\Mapping\Event;
use Hyperf\Database\Events\StatementPrepared;
use PDO;
/**
* @Event(alias=EventEnum::DbFetchMode)
*/
class FetchModeEvent implements EventDispatcherInterface
{
/**
* @param $event
*/
public function dispatch(...$param){
$event = $param[0];
if ($event instanceof StatementPrepared) {
$event->statement->setFetchMode(PDO::FETCH_ASSOC);
}
}
}

@db 操作

https://hyperf.wiki/#/zh-cn/db/querybuilder