0

i want to include pagination ajax class to yii2. how can i do that? when i use below code :

<?
	$url = Yii::app()->basePath.'/../vendor/phpunit/phpunit/src/Extensions/Pagination.php';
include $url;

?>

in controller and also below code:

require_once Yii::app()->basePath . '\..\vendor\phpunit\phpunit\src\Extensions\Pagination.php';

but both of them shows below error:

Call to undefined method Yii::app()

how can i fix it? is it true way to save pagination.php? please help me to include this file to my yii2 project..

thannks all :)

1
  • Yii::$app->basePath Commented Aug 14, 2017 at 13:34

1 Answer 1

1

You are using the wrong access to yii2 components

In yii2 you should use $app

Yii::$app->->basePath

and not Yii::app()

Sign up to request clarification or add additional context in comments.

5 Comments

can you please tell me how to set stream ?because is fail to open stream . is it true way??
i don't know ... why you are using require_once for extension .. normally the extension are installed by composer and loaded by autoload .. ..
how can i do that?
Setting unknown property: yii\data\Pagination::baseURL.it shows this.whats wrong?
try take a look at how use phpunit in yii2 yiiframework.com/doc-2.0/guide-test-unit.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.