1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 |
//Temp model in import function
'table' => 'SOP10100',
'ds' => 'external',
'name' => 'RemoteHeader',
// 'alias' => 'InvoiceHeader',
'primaryKey' => 'SOPNUMBE',
'foreignKey' => 'SOPNUMBE',
'counterCache' => false
))));
//fetch
'SOPNUMBE',
'CUSTNAME',
'DUEDATE',
'DOCDATE',
'DOCAMNT',
'SUBTOTAL')));
//fetch result with no ALIAS set
'SOPNUMBE' => 'SVC0202088 ',
'CUSTNAME' => 'LOUISIANA ENERGY CONSULTANTS, INC. ',
'DUEDATE' => '2012-05-17 00:00:00',
'DOCDATE' => '2012-04-17 00:00:00',
'DOCAMNT' => '.00000',
'SUBTOTAL' => '.00000'
)
)
//fetch result with ALIAS set
'SOPNUMBE' => 'SVC0202088 ',
'CUSTNAME' => 'LOUISIANA ENERGY CONSULTANTS, INC. ',
'DUEDATE' => '2012-05-17 00:00:00',
'DOCDATE' => '2012-04-17 00:00:00',
'DOCAMNT' => '.00000',
'SUBTOTAL' => '.00000'
)
//Load local model in save function
$this->loadModel('InvoiceHeader');
}
//Problem
If I remove the alias in the temp model, loadModel loads correct model, but $data has incorrect element name -- RemoteHeader. If I add the alias, the reverse is true. |
