cakephp3 他のモデル利用

controller

use Cake\ORM\TableRegistry;

public function index()
{
    $this->Model = TableRegistry::get('Model');
    $addreses = $this->Model->find()->all();
    // 条件を指定する場合
    // $addreses = $this->Model->find()->where(['id'=>1]); 等
    $this->set('addreses', $addreses);
}

view

<?php foreach($addreses as $data): ?>
<?= $data->xxx; ?>
<?php endforeach; ?>
PAGE TOP