Skip to content

View Cell render not be call initController #2500

Description

@byazrail

Direction
view_cell('App\Controllers\Test::index');

Test Extending Parent initController core extend. not be call.

sample;

<?php namespace App\Controllers
protected $testData;
Test extends App\Controllers\BaseController
{
	public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
	{
		parent::initController($request, $response, $logger);
		// Autoloads
		$this->testData = 22; // Dummy test variable.
	}

	public function index()
	{
		return $this->testData;
	}

view_cell('App\Controllers\Test::index'); return null;

solution;
system\View\Cell::render

// Not cached - so grab it...
$instance = new $class();

change

use Config\Services;

// Not cached - so grab it...
$instance = new $class();
$instance->initController(Services::request(), Services::response(), Services::logger());

I found a solution like this, but I don't know exactly how good it will be.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions