Referring to Methods (Naming Conventions)

I am very new to Yii and even newer to developing applications with a framework. I tried searching for this same type of question but came up empty handed (could just be bad searching on my part) so I decided to post a new topic.

While going through the "Agile Web Application Development with Yii1.1 and PHP5" I have found myself lost with the reasons for the naming conventions when referring to methods. To help explain my answer I will use an example.

At the end of chapter 6 after performing the "reader exercise" I also went out to do some research and found the following topics and posts:

Chapter 6 Exercise

If you look at the last post there it shows using:




$data->project->name

$data->typeText

$data->statusText



$data->project->name

I think I understand the first line, but if I am wrong please let me know. My thought process is that we take our data variable which houses our issue AR model. This then refers to the relations method of our Issue Model where ‘project’ is defined, and using that relationship we retrieve the name attribute/column of the issue.

$data->typeText and $data->statusText

So I tried those lines out and it works perfectly fine and from that I can deduce that ‘typeText’ and ‘statusText’ refers to the getter methods in the Issue Model class even though the name of the actual method is ‘getStatusText’ and ‘getTypeText’ respectively. Now I realize the book has done this several times up to now but it never really answers my question.

[list=1]

[*]Is it simply because we named our methods using the naming convention ‘getSomeThing’ that the framework allows us to refer to that method as simply ‘someThing’?

[*]Does this only apply to specific types of methods?

[*]And their specific naming convention?

[*]And can I only refer to them within specific files?

[/list]

I also wrote the last 2 lines as:




$data->getTypeText()

$data->getStatusText()



And they work as well. Those lines make more sense to me just because I am referring to the exact names of the methods. So I am guessing that either approach will work or is this just a coincidence?

I am trying to obtain a higher level of understanding of Yii so if anyone could answer the above questions with maybe an explanation or possibly links to where I can find out more information concerning the subject of this post that would be great!

Can anyone answer this question? or perhaps I asked the question in the wrong forum.

/* moved to General Discussion from Agile Web Application Development with Yii1.1 and PHP5 */

This wiki article explains it.

/Tommy