Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View Cell render not be call initController #2500

Closed
byazrail opened this issue Jan 19, 2020 · 0 comments · Fixed by #2501
Closed

View Cell render not be call initController #2500

byazrail opened this issue Jan 19, 2020 · 0 comments · Fixed by #2501
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@byazrail
Copy link
Contributor

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.

@byazrail byazrail added the bug Verified issues on the current code behavior or pull requests that will fix them label Jan 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant