cakephp - Cake 3.x: List all models -
i need list of models of application (including plugins).
in cake 2 use app::objects('model');
. how able in cake 3.x?
thanks!
bob
i'm not sure if helps, should give information you're going able get. point of commenter(s), there aren't "models" in cakephp 3 - there tables , entities.
use cake\datasource\connectionmanager; use cake\orm\tableregistry; // ... $tables = connectionmanager::get('default')->schemacollection()->listtables(); foreach($tables $key => $table) { $tabledata = tableregistry::get($table); debug($tabledata); }
returns each table:
object(app\model\table\photostable) { 'registryalias' => 'photos', 'table' => 'photos', 'alias' => 'photos', 'entityclass' => '\cake\orm\entity', 'associations' => [ (int) 0 => 'tags', (int) 1 => 'categorized' ], 'behaviors' => [ (int) 0 => 'timestamp', (int) 1 => 'sluggable' ], 'defaultconnection' => 'default', 'connectionname' => 'default' }
Comments
Post a Comment