How to make cakephp 2.0 model without database table?

How to get data from a model using $ useTable = false

I tried, in fact, it does not work.

class Blablah extends AppModel { public $useTable = false; public $data = array( array( "id"=>0, "fied1" => "bla", "field2" =>"blah"), ... ); } 
+4
source share
2 answers

There is already a pretty good answer in this section here in StackOverflow.

You should also check out various data sources - this may be exactly what you are looking for. I would use array_source for what you need.

+1
source

In the controller action, you can load the required model and access its data as:

 $this->loadModel('Blablah'); debug($this->Blablah->data); 
0
source

Source: https://habr.com/ru/post/1437261/


All Articles