0

Im wondering if someone could give me some help.

I'm very new to the Yii framework and im taking over some code for a friend.

Would someone be kind enough to tell me what the following lines do.

$variable = new ModuleModel('search'); $another->columns = $variable->search()->data; 

I've never seen something passed when creating a new model instance and im not sure what the 'data' call does.

Any help would be greatly appreciated.

Cheers,

1
  • print $variable->search() to check what it returns Commented Aug 27, 2017 at 13:05

1 Answer 1

0

$variable = new ModuleModel('search');

this line call a method search() from class ModuleModel. This is used with CGridView for searching and filtering you will find somwthing helpful here

$variable->search()->data

This is accesing property from object where $variable->search() will return object and data is property of an object it's same as an

$searchData = $variable->search(); $searchData->data; 

finally this line

$another->columns = $variable->search()->data;

assign data property from $variable->search() to $another->columns

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

2 Comments

Thanks for your answer, so data is a Yii function? Is there a way to show only specific columns from this?
data is an property of an class. use print( $variable->getData() ) to print whatever data return. and share this data for more clear full understanding

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.