php - How do I get the table schema/columns from an entity object in cakephp 3? -
let's have bonified \cake\orm\entity
object -- $kablammo
can confirm , make sure has associated repository doing following:
use cake\orm\entity; // ..snip if ($kablammo instanceof entity && !empty($kablammo->source())) { $repository = $kablammo->source(); // ... do here table schema info/columns? }
i'd able view table columns entity's associated table basically. what's best way this? going wrong already?
i think figured out.
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()); }
at least i'm on right track now.