cfmgrv4 init...1

This commit is contained in:
최준흠 2024-10-14 16:02:53 +09:00
parent 3e2a27d4d6
commit 5f9cfda7be
3 changed files with 15 additions and 3 deletions

View File

@ -15,6 +15,7 @@ class AccountController extends CloudflareController
{
private $_model = null;
private $_auth_entity = null;
private $_myLibrays = [];
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@ -32,7 +33,10 @@ class AccountController extends CloudflareController
}
final protected function getMyLibrary(): Account
{
return new Account($this->_auth_entity);
if (!isset($this->_myLibrays[$this->_auth_entity->getPK()])) {
$this->_myLibrays[$this->_auth_entity->getPK()] = new Account($this->_auth_entity);
}
return $this->_myLibrays[$this->_auth_entity->getPK()];
}
protected function getFormFieldOption(string $field, array $options = []): array
{

View File

@ -15,6 +15,7 @@ use Psr\Log\LoggerInterface;
class RecordController extends CloudflareController
{
private $_zone_entity = null;
private $_myLibrays = [];
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@ -32,7 +33,10 @@ class RecordController extends CloudflareController
}
final protected function getMyLibrary(): Record
{
return new Record($this->_zone_entity);
if (!isset($this->_myLibrays[$this->_zone_entity->getPK()])) {
$this->_myLibrays[$this->_zone_entity->getPK()] = new Record($this->_zone_entity);
}
return $this->_myLibrays[$this->_zone_entity->getPK()];
}
protected function getFormFieldOption(string $field, array $options = []): array
{

View File

@ -16,6 +16,7 @@ use Psr\Log\LoggerInterface;
class ZoneController extends CloudflareController
{
private $_account_entity = null;
private $_myLibrays = [];
private $_model = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
@ -34,7 +35,10 @@ class ZoneController extends CloudflareController
}
final protected function getMyLibrary(): Zone
{
return new Zone($this->_account_entity);
if (!isset($this->_myLibrays[$this->_account_entity->getPK()])) {
$this->_myLibrays[$this->_account_entity->getPK()] = new Zone($this->_account_entity);
}
return $this->_myLibrays[$this->_account_entity->getPK()];
}
protected function getFormFieldOption(string $field, array $options = []): array
{