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.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -