I want to extend the class yii\web\Response. So I created a new class Response in the folder components and I try to overwrite the send method.
namespace app\components;
use Yii;
class Response extends \yii\web\Response{
public function init(){
parent::init();
}
/**
* Sends the response to the client.
*/
public function send()
{ ...
Finally I tried to import my new Response-Class by importing it in the config.
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'components' => [
'import' => [
'class' => 'app\components\Response',
],
Why is it not going to work like this?
Try it like this:
'components' => [
'response' => [
'class' => 'app\components\Response',
],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With