如何从 cakephp 3 中的实体对象获取 table schema/columns?

How do I get the table schema/columns from an entity object in cakephp 3?

假设我有一个 bonified \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?
}

我基本上希望能够查看此实体的关联 table 的 table 列。最好的方法是什么?我是不是已经做错了?

我想我明白了。

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());
}

至少我现在走对了。