如何从cakephp 3中的实体对象获取表模式/列?

Kev*_*vin 6 php cakephp-3.0

假设我有一个绑定\Cake\ORM\Entity对象 - $kablammo 我可以通过执行以下操作确认并确保它具有关联的存储库:

use Cake\ORM\Entity;

// ..snip

if ($kablammo instanceOf Entity && !empty($kablammo->source())) {
    $repository = $kablammo->source();
    // ... what do I do here to get the table schema info/columns?
}
Run Code Online (Sandbox Code Playgroud)

我希望能够基本上查看此Entity关联表的表列.最好的方法是什么?我已经错了吗?

Kev*_*vin 9

我想我明白了.

use Cake\ORM\Entity;
use Cake\ORM\TableRegistry;

// ..snip

if ($kablammo instanceOf Entity && !empty($kablammo->source())) {
    $repository = $kablammo->source();
    $table = TableRegistry::get($repository);
    debug($table->schema());
}
Run Code Online (Sandbox Code Playgroud)

至少我现在正走在正确的轨道上.