Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cakephp how to find all model name

I have a job to import excel file and save the data to database via cakephp, the probleme is, this application allow user to choose the table that he want to used to save the data from excel file, so i need to list all the model name, i have search through google how to get all model name but i can't find it. I just can get all the table name, but this is not enough. I must know all the model name, please help me...

I can get all the field name uses this code:

$this->loadModel('Person');
        $fieldsArray=$this->Person->find('all');
        $fieldsArray=Set::extract('/0/Person',$fieldsArray);
        $fieldNames=array_keys($fieldsArray[0]['Person']);
        debug($fieldNames);

but as you can see, i have to know the model name, i can't solve this problem, please help me..

Best regards...

like image 807
user1290932 Avatar asked Nov 29 '22 03:11

user1290932


1 Answers

$Model = App::objects('Model');
pr($Model);
like image 137
sankar.k Avatar answered Dec 20 '22 07:12

sankar.k