Skip to content

Commit

Permalink
Merge pull request #6910 from kenjis/fix-controller-request-type
Browse files Browse the repository at this point in the history
fix: $request type in BaseController and BaseResource
  • Loading branch information
kenjis authored Dec 7, 2022
2 parents 9be490d + 738ec56 commit b395a84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/Controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace App\Controllers;

use CodeIgniter\Controller;
use CodeIgniter\HTTP\CLIRequest;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
Expand All @@ -22,7 +24,7 @@ abstract class BaseController extends Controller
/**
* Instance of the main Request object.
*
* @var RequestInterface
* @var CLIRequest|IncomingRequest
*/
protected $request;

Expand Down
10 changes: 10 additions & 0 deletions system/RESTful/BaseResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,21 @@
namespace CodeIgniter\RESTful;

use CodeIgniter\Controller;
use CodeIgniter\HTTP\CLIRequest;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;

abstract class BaseResource extends Controller
{
/**
* Instance of the main Request object.
*
* @var CLIRequest|IncomingRequest
*/
protected $request;

/**
* @var string|null The model that holding this resource's data
*/
Expand All @@ -34,6 +43,7 @@ abstract class BaseResource extends Controller
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);

$this->setModel($this->modelName);
}

Expand Down

0 comments on commit b395a84

Please sign in to comment.