用YII开发一个项目,遇到问题,关于relational AR,如何取得查询的值

在guide中有一段话:

4.4.3 Relational Query Options

We mentioned that additional options can be specified in relationship declaration. These options, specified as name-value pairs, are used to customize the relational query. They are summarized as below.

select: a list of columns to be selected for the related AR class. It defaults to '*', meaning all columns. Column names should be disambiguated using aliasToken if they appear in an exp​ression (e.g. COUNT(??.name) AS nameCount

举个例子怎么访问nameCount?

首先声明一个nameCount的类变量,然后就可以访问了:$model->nameCount

试了,好像不行,提示说变量未定义

强哥正解