I am using cake php
I have a table called relates that holds the primary id values from
the other tables.
I used cakephp to generate the crud. it works fine. if you click on
the number in the relates table it goes to the appropriate table and
displays the information like it should.
how can you combine the information from the other tables and display
the information instead of showing the relationships primary ids?
example:
//relate table show this
Client 1
Client Address 1
Contact 1
Contact Info 1
Accounting 1
I would like to look like this
client: john smith
client: address 123 easy st
Contact: sam
Contact Info: 714-822-
Accounting: 500.00
I know my code for the model is not correct but when i join the tables
i get no errors but the tables that i join do not display. basically i
need this query to be used but i cant figure how to make it show more
than one table at a time
PHP Syntax (Toggle Plain Text)
1.
array(
11.
'className' => 'Relate',
12.
'foreignKey' => 'relate_id',
13.
'conditions' => '',
14.
'fields' => '',
15.
'order' => ''
16.
),
17.
'Client' => array(
18.
'className' => 'Client',
19.
'foreignKey' => 'client_id',
20.
'conditions' => '',
21.
'fields' => '',
22.
'order' => ''
23.
),
24.
'ClientAddress' => array(
25.
'className' => 'ClientAddress',
26.
'foreignKey' => 'client_address_id',
27.
'conditions' => '',
28.
'fields' => '',
29.
'order' => ''
30.
),
31.
'Contact' => array(
32.
'className' => 'Contact',
33.
'foreignKey' => 'contact_id',
34.
'conditions' => '',
35.
'fields' => '',
36.
'order' => ''
37.
),
38.
'ContactInfo' => array(
39.
'className' => 'ContactInfo',
40.
'foreignKey' => 'contact_info_id',
41.
'conditions' => '',
42.
'fields' => '',
43.
'order' => ''
44.
),
45.
'Accounting' => array(
46.
'className' => 'Accounting',
47.
'foreignKey' => 'accounting_id',
48.
'conditions' => '',
49.
'fields' => '',
50.
'order' => ''
51.
),var $hasOne = array(
52.
'ChildRelate' => array(
53.
'className' => 'Relate',
54.
'foreignKey' => 'relate_id',
55.
'dependent' => false,
56.
'conditions' => '',
57.
'fields' => '',
58.
'order' => ''
59.
)
60.
);
61.
62.
var $hasMany = array(
63.
'ChildRelate' => array(
64.
'className' => 'Relate',
65.
'foreignKey' => 'relate_id',
66.
'dependent' => false,
67.
'conditions' => '',
68.
'fields' => '',
69.
'order' => '',
70.
'limit' => '',
71.
'offset' => '',
72.
'exclusive' => '',
73.
'finderQuery' => '',
74.
'counterQuery' => ''
75.
)
76.
);
77.
78.
}
79.
?>
array( 'className' => 'Relate', 'foreignKey'
=> 'relate_id', 'conditions' => '', 'fields' => '', 'order' => '' ),
'Client' => array( 'className' => 'Client', 'foreignKey' =>
'client_id', 'conditions' => '', 'fields' => '', 'order' => '' ),
'ClientAddress' => array( 'className' => 'ClientAddress', 'foreignKey'
=> 'client_address_id', 'conditions' => '', 'fields' => '', 'order' =>
'' ), 'Contact' => array( 'className' => 'Contact', 'foreignKey' =>
'contact_id', 'conditions' => '', 'fields' => '', 'order' => '' ),
'ContactInfo' => array( 'className' => 'ContactInfo', 'foreignKey' =>
'contact_info_id', 'conditions' => '', 'fields' => '', 'order' =>
'' ), 'Accounting' => array( 'className' => 'Accounting', 'foreignKey'
=> 'accounting_id', 'conditions' => '', 'fields' => '', 'order' =>
'' ),var $hasOne = array( 'ChildRelate' => array( 'className' =>
'Relate', 'foreignKey' => 'relate_id', 'dependent' => false,
'conditions' => '', 'fields' => '', 'order' => '' ) ); var $hasMany =
array( 'ChildRelate' => array( 'className' => 'Relate', 'foreignKey'
=> 'relate_id', 'dependent' => false, 'conditions' => '', 'fields' =>
'', 'order' => '', 'limit' => '', 'offset' => '', 'exclusive' => '',
'finderQuery' => '', 'counterQuery' => '' ) ); } ?>
heres the sql query. relate is the table that relates all the tables
together
I know that the names are not complaint to cakephp's name scheme but
it will be. I am justing looking for some direction and a format to
help me out
"SELECT
agency.agency,
agency_address.agent_address,
agency.agency_id,
bond.bond_number,
bond.Surety,
bond.bond_type,
bond.paying_state,
bond.bond_state,
bond.term,
bond.cancellation_clause,
bond.bond_amt,
bond.first_issue_date,
bond.issue_date,
bond.exp_date,
bond.red_stared,
bond.red_stared_date,
bond.date_purged,
bond.bond_id,
client.client_id,
client.client_name,
agency_contact.agent_first,
agency_contact.agent_last,
agency_info.agent_phone,
agency_info.agent_fax,
agency_info.agent_email,
bond.bond_nu