feat : Proxy Subject and Database
This commit is contained in:
40
app/Service/Test/Proxy/Dynamic/RealDatabaseQueryService.php
Normal file
40
app/Service/Test/Proxy/Dynamic/RealDatabaseQueryService.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* This service file is part of item.
|
||||
*
|
||||
* @author ctexthuang
|
||||
* @contact ctexthuang@qq.com
|
||||
* @web_site https://ctexthuang.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Service\Test\Proxy\Dynamic;
|
||||
|
||||
use App\Interface\Test\Decorator\LoggerInterface;
|
||||
use App\Interface\Test\Proxy\DatabaseQueryInterface;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
|
||||
|
||||
class RealDatabaseQueryService implements DatabaseQueryInterface
|
||||
{
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
#[Inject]
|
||||
protected LoggerInterface $logger;
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @return string[]
|
||||
*/
|
||||
public function execute(string $query): array
|
||||
{
|
||||
$this->logger->log('Executing query: ' . $query . PHP_EOL);
|
||||
|
||||
return [
|
||||
'result' => 'data',
|
||||
'query' => $query,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user