Let's say I have a bonified \Cake\ORM\Entity
object -- $kablammo
I can confirm and make sure it has an associated repository by doing the following:
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?
}
I'd like to be able to view the table columns for this Entity's associated table basically. What's the best way to do this? Am I going about it wrong already?
I think I figured it 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 the right track now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With