Cakephp 如何获取更多字段

Cakephp 如何获取更多字段,cakephp,cakephp-2.0,Cakephp,Cakephp 2.0,我的查询只返回库id。我需要在视图中显示标题。我怎样才能得到要展示的标题。 这是我的共享模型 public $belongsTo = array( 'Person' => array( 'className' => 'Person', 'foreignKey' => 'person_id', 'conditions' => '', 'fields' =>

我的查询只返回库id。我需要在视图中显示标题。我怎样才能得到要展示的标题。 这是我的共享模型

public $belongsTo = array(
        'Person' => array(
            'className' => 'Person',
            'foreignKey' => 'person_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'Library' => array(
            'className' => 'Library',
            'foreignKey' => 'library_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        )
    );
这是我的图书馆模型

class Library extends AppModel {

    //The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * hasMany associations
 *
 * @var array
 */
    public $hasMany = array(
        'Share' => array(
            'className' => 'Share',
            'foreignKey' => 'library_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => 'Title',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        ),
        'Work' => array(
            'className' => 'Work',
            'foreignKey' => 'library_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        )
    );

}
这是我在控制器中的add方法

public function add() {
        if ($this->request->is('post')) {
            $this->Share->create();
            if ($this->Share->save($this->request->data)) {
                $this->Session->setFlash(__('The share has been saved'));
                $this->redirect(array('action' => 'index'));
            } else {
                $this->Session->setFlash(__('The share could not be saved. Please, try again.'));
            }
        }
        $people = $this->Share->Person->find('list');
        $libraries = $this->Share->Library->find('list');
        $this->set(compact('people', 'libraries'));
    }
这是我的观点

<div class="shares form">
<?php echo $this->Form->create('Share');?>
    <fieldset>
        <legend><?php echo __('Add Share'); ?></legend>
    <?php
        echo $this->Form->input('person_id');
    echo $this->Form->input('library_id');
        echo $this->Form->input('share');

    ?>
    </fieldset>
<?php echo $this->Form->end(__('Submit'));?>
</div>

别介意这个问题,首先我需要做的是

$libraries=$this->Share->Library->find('list',array('fields'=>'Library.Title'))

图书馆管理员

谢谢